An implementation of underwater effects that show under the water line.
Download the files by clicking the green Code button on the top right corner of this repo. Extract the zip file and drag the folder into your assets of your unity project.
Feel free to use this in anything commercial or personal. Credit would be greatly appreciated but isn't required.
In your URP render settings, click add feature and choose Horizon Line Texture and any of the additional effects shown. Set the Horizon Line Texture render pass event to before post processing and set the additional effect's render pass events to before post processing. Make sure that the horizon texture pass is the first pass called. It should work after that.
If you are using hlsl (urp shader code), make sure your shader has the following snippet in the pass or subshader blocks.
Blend SrcAlpha OneMinusSrcAlpha
LOD 300
Tags
{
"Queue" = "Transparent"
"RenderType" = "Transparent"
"RenderPipeline" = "UniversalRenderPipeline"
}
If you are using shader graph, make sure your graph settings look like this:
If you wish to add more effects on top of the existing ones, you need to sample the _HorizonLineTexture. This lets you seperate the waterline from the air above the water.
- Caustics
- Distortion
- Sunrays
- Better Waterline Transition
If you wish to contriubute to this repo, feel free to make a pull request.