This project demonstrates three procedural shadergraphs, for creating immersive underwater caustics and water surface with distortion. All shadergraphs are meant to be used as templates for your own shaders.
NOTE: In order to use the graphs in your own projects, export them as a unitypackage, rather than copying the shadergraph files. This will ensure the subgraph references are not lost
- Open the project with Unity (2022.2.5f1 and URP/Shadergraph 14 or later recommended) and open SampleScene.unity in the Scenes folder
- Make sure the render pipeline is set to URP in Project Settings> Graphics
- Select the UniversalRenderPipelineAsset and make sure Opaque Texture and Depth Texture are both enabled.
- Under Player settings, select Linear color space for best color representation
- In the Asset>Graphs folder you can find two separate shadergraphs for Underwater Caustics and Water surface
- These graphs have several customization options, such as:
- Adjustable Shorelines using the depth texture
- Water clarity, opacity, refraction (through distortion)
- Triplanar Underwater caustics
- Adjustable flow speeds for surface as well as caustics
- A full screen render feature is added for underwater tint and distortion. With URP 14+ You can also use a local volume for tint, but it will not include distortion.
- Make sure the project is properly set up and all graphs are working.
- Remove URP completely from the project.
- Install HDRP from the package manager. Use the HDRP wizard to fix any issues during setup.
- In the WaterSurface Shadergraph, change the 'Scene Color' Node to 'HD Scene Color'. This will fix the overexposed water .
- In the WaterUnder Shadergraph, find the Position node, and change the space to Absolute World. This will fix caustics moving with the camera.