Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Water Reflectivity

Discussion in 'Editor & General Support' started by jeffcraighead, Dec 14, 2006.

  1. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    Is there any way to control how much reflection (render texture opacity?) is placed on a water plane with the Reflective/Refractive water? The water looks mirror like at the moment, which is not exactly what I'm looking for.

    Thanks,

    Jeff
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    The amount of reflection vs. refraction depending on the viewing angle is controlled with the fresnel texture. Edit it as you like.
     
  3. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    So white=reflection black=refraction as far as I can tell, is this correct? I can't find the description of this in the manual.

    Thanks
    Jeff
     
  4. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    OK part of the problem before was that I didn't have anything below the water so adjusting the alpha texture didn't seem to do much. The results are much more obvious now. However I would still like more detailed documentation on HOW the alpha is interpreted. How is the specific alpha for a given angle determined?

    Jeff
     
  5. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    You can see it in the water shader code (look for "fresnel"). Note that water is nothing magic, it's just shaders, textures and scripts that are included in standard assets. Anyone could write a completely different water implementation, or tweak existing ones.

    Basically, a dot product is taken between view direction and "wave normal". The dot product essentially returns the cosine of the angle between the two. It approaches 1 when looking straight down onto the water; and 0 when looking along the water surface.

    This value is used to lookup into the Fresnel texture. The looked up alpha value interpolates between refraction and reflection.

    So in general the fresnel texture should have bright alpha on the left side and dark alpha on the right side, with anything that "looks good" in between.