Procedural Water surface and underwater caustics for Unity URP
License: MIT License
urp-watershaders's Introduction
URP-WaterShaders
Procedural Water Surface and Underwater Caustics for Unity URP
This project demonstrates two procedural shadergraphs, for creating immersive underwater caustics and water surface with distortion. Both shadergraphs are meant to be used as templates for your own shaders.
Demo Video
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
Instructions
Open the project with Unity (2019.4.3f1 and URP/Shadergraph 7.3.1 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
Instructions for HDRP
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.