Search Unity

Unity Water Reflection artifacts

Discussion in 'Shaders' started by Gooren, Jul 29, 2018.

  1. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi,

    We have a problem with Unity Water from Standard Assets (Water.cs script; "FX/Water" shader) when we use a high density fog. The problem is illustrated in the attached screenshots. The artifact/bug occurs only on transparent PIXEL-LIT objects reflection. Vertex-lit transparent objects are reflected correctly under all viewing angles.

    - In the following screenshot, everything looks ok (tree leaves that are transparent pixel-lit objects are completely visible, therefore the issue does not appear) Screenshot1.png

    - However in the following screenshot, I rotated the camera slightly upwards, therefore making some of the tree leaves vertices culled. In this case the issue appears. Again, this happens only with pixel-lit transparent shaders and not with vertex-lit transparent shaders. Does anyone have any idea why? Screenshot2.png

    - For the sake of better illustration of the issue occurance/behavior, here is one more screenshot that shows what happens when I rotate the camera even further in the upwards directions, culling all of the "bottom" vertices of the tree leaves in the process. Screenshot3.png

    EDIT1: I tried all of the various water prefabs from the Standard Assets and all of them show the same behavior. I also tried it in a separate project, on two different machines. The issue persists.

    EDIT2: Demo project 'Fog Test.7z' added (open the "WaterDemo" scene and view the cube and it's reflection under various vertical angles as shown in the following images) Screenshot4.png HINT: In the "WaterDemo" scene, you can change the shader of the "CubePrototype02x02x02" cube to something vertex-lit, for example "Particles/VertexLit Blended" and the issue will disappear. What the heck? Why do the vertex-lit shaders work while the pixel-lit shaders don't?

    EDIT3: Could it be caused by the vertex culling? If it's performed for pixel-lit shaders but not for vertex-lit shaders, which somehow makes sense to me, then that could explain everything. Unfortunately I can't test this theory, since it's impossible to disable the vertex culling. Vertex culling is performed by the GPU, therefore I am out of luck, right?
    If this theory is right, then the problem is either by design or maybe solvable only by Unity?
     

    Attached Files:

    Last edited: Jul 30, 2018
    breban1 likes this.
  2. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Last edited: Aug 2, 2018