- Home /
Combining multiple layers and water
I have a major problem with my depth buffers and I hope that someone knows a good fix for this one.
I am using two layers for drawing. The first layer draws the background of my scene, which is very far away. It uses a clipping plane of 100 - 10000. When this is done, the depth buffer is cleared by the second camera and it draws the default objects into the scene (cl pl: 0.3 - 1000).
Updated
This worked just fine, until I started to use Water 4 (Pro and Simple). The water shader seems to do something with my backbuffer when the water is drawn. You can actually see the previous frame in the air, instead of my backgrounds from the first camera.
I have narrowed the problem down to the shader only by disabling all scripts that were attached to the prefab. The shader seems to be the problem. When I change it to Diffuse, everything is fine again.
I cannot place a picture of my game because of confidentiality, but I can post a diagram of what I'm doing.
So the first problem summarizes to: How can I remove this strange effect and let the background return to its original state? Why is the water shader blocking this?
The second problem has to do with Warwick's comment. How do I get both cameras in my reflection? Do I have to change the code of the water script?
Water doesn't clear the display color buffer, only that of the RenderTexture it is targeting. Or is your problem simply that the reflection is only reflecting the near objects in your scene?
@Warwick Allison: I will post an example movie of my problem and will include a diagram of my scene flow tomorrow. The problem you are describing is indeed also a problem that I'm dealing with, but is not the problem described above. I think I will have to adjust the code of the water scripts, which is something I actually don't want to do.
@Warwick Allison: You are completely right. It is not the clearing of the buffers. See my updated question. It is actually quite different now.
Having the same Problem. Is there a solution other than not using the unity water?
It is related to GrabPass and Forward rendering vs Defered rendering. See this link.
Your answer
Follow this Question
Related Questions
Clear depth buffer between two layers 0 Answers
Bloom to Only effect Objects on UI layer ? 0 Answers
Water effect on camera lens 2 Answers