Search Unity

Question Water transition from surface to underneath

Discussion in 'High Definition Render Pipeline' started by ImperialDragon98, Jan 31, 2020.

  1. ImperialDragon98

    ImperialDragon98

    Joined:
    Nov 7, 2018
    Posts:
    28
    Currently i'm making a game with the latest hdrp update, unity 2019.2.17f1. My end goal is to achieve a water transition like this screenshot. How did Subnautica have the underwater effect only affect the portion of the screen that is under water. Would you build this with a shader if so please answer in shader graph format? Some help getting this started would be very appreciated.
     
  2. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    133
    The underwater look is usually done via post processing. But it's a tough nut to crack.
    In fact, if you notice, most games don't have a good implementation, they either hide the transition from over the water to underwater or they just say screw it and you can clearly see when the post processing change happens.
    The first game with a really good implementation that I noticed was Far Cry 3, looking into it I discovered that the underwater look is done via post processing, and it is masked by the waves position on the screen.
    So you have 2 post processing layers happening, one for the game over the water and one for the game underwater, when you position the camera in such a way where you can see half of each, like in your screenshot, these post processing effects are masked by the waves position on screen so that the underwater look doesn't bleed outside or the other way around.

    I have not used the shader graph yet so I don't know it's limitations, but if you can create a custom post processing material with it, kind of like you do in UE4 if you are familiar, and get the position of vertices of a mesh, (the water surface), you could in theory do it.
     
    MaxHerrmann likes this.