Search Unity

Water section effect?

Discussion in 'Shaders' started by topofsteel, Dec 24, 2018.

  1. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    How would I create water section effect like the one in the image. All of the assets / shaders I have found are either for the surface or underwater. Applying a basic transparency isn't even close to what i'm looking for. Thanks.

    ac9ed5d2c8c594d355a08f82df3e0222.jpg
     
  2. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Since the "volume" and the surface of the water have pretty different visuals (ways in which they are rendered), the most straight forward approach would be to split the water into two parts.
    Assuming you have one cube of water, you'd use a different material for the sides and the surface.
    For the intersection you'd have additional geometry, reusing the vertex shader part for offsets (assuming your surface has tessellation, animation, ...).

    As for the sides, they'd either use their own material (as mentioned above), or you could simply render another scene and use the stencil buffer to make it visible.