Hello everyone,
I’m working with the Unity Water System in HDRP and would like to customize how the underside of the water plane is rendered. Could anyone guide me on which specific script or shader file in HDRP is responsible for handling the underside rendering of the water surface? I’m hoping to modify it to achieve a specific visual effect.
Thank you in advance for any help or pointers!
There’s a node in the shader graph called HDSampleBuffer, in there, there’s a dropdown allowing you to get a mask of when your camera is underwater or not.
In the Underwater scene in the HDRP package manager water sample project, there’s example on how to setup a custom pass to customize the water rendering a little.
If you are looking to modify the shader themselves, you can definitely do it.
We can’t really provie any support but there is a lot in those files:
- com.unity.render-pipelines.high-definition/Runtime/Material/Water/Water.hlsl
- com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/UnderWaterUtilities.hlsl
2 Likes
Have you ever solved this?
I get a very bad circle transparent surface under the water. Is there any Way to make IT all transparent ?
1 Like
I was finding a solution for exact same problem, it’s a bit hard to figure out what to tweak in order to change the underwater effects since there’s a ton shader files in the water system. I’ve been away from unity for a while due to studies, if I find a workaround I’ll let you know.
1 Like
The “very bad circle” you see, is total internal reflection and is very close of what happens in real life (cf reference).
Basically, when looking at water, rays that are close to being perpendicular to the surface get refracted (go through) and rays that are more at grazing angle of the water surface gets reflected. Diagram
Now that we have that out of the way, you can easily remove Total Internal Reflection by changing the function ComputeWaterRefractionParams in WaterUtilities.hlsl like this :
Before :
After:
Hope that helps 
2 Likes