UnityEngineWater Caustics Shader2023-01

With HLSL and Shader Graph in Unity URP
Shader GraphHLSLURPUnity
View on GitHub

Water Caustics Shader with dynamic configurations.

Implementation

  • Using HLSL to get the Main Light data, including direction, color and distance/shadow attenuations.
  • Triplanar Projection + UVs Rotation + Animated UVs Offset implemented in HLSL.
  • Tiling, Offset, Speed and Rotation of the Caustics Texture, using a Custom Function Node in Shader Graph.
  • Distortion of the Caustics Texture using a Simple Noise Node, and some dynamic configurations.
  • Oclussion of the Caustics using the Distance/Shadow Attenuation from the Main Light, also using a basic Lambert Shading.
  • Using Global/Ambient Illumination to incorporate the Scene Ambient Lighting into the mix.
  • Masking the Caustics and adding it onto the Albedo Main Texture for the surfaces.