Simulate currents with a water decal
To add deformation, foam, or current effects to a water surface, use a water decal, which is a texture projected onto the surface.
A water decal is a shader graph Master Stack. It's applied in world space, allowing it to project across the water surface and integrate with the entire environment, not just a single area.
By default, water decal regions are anchored to the camera. You can also anchor them to a GameObject.
Note
For backward compatibility, water decals are disabled by default.
Create a water decal
In the main menu, select GameObject > Water > Water Decal.
Unity adds a Water Decal GameObject to your scene.
Move the Water Decal GameObject to the area of water you want to affect.
To add deformation, foam, or current effects to the water decal shader graph, select the Water Decal GameObject, then under Water Decal (Material) select Edit....
By default, the water decal shader graph Master Stack contains the following properties:
- Deformation
- SurfaceFoam
- DeepFoam
Once you have enabled mask and current water decals, you can add the following water features through the Graph Inspector:
- HorizontalDeformation.
- SimulationMask
- SimulationFoamMask
- LargeCurrent
- LargeCurrentInfluence
- RipplesCurrent
- RipplesCurrentInfluence
Enable horizontal deformation
To enable horizontal deformation, go to the active HDRP Asset, then under Rendering > Water enable Horizontal Deformation.
Enabling horizontal deformation has the following effects:
- HDRP creates a new buffer, which increases the amount of memory HDRP uses.
- The results of water scripts and underwater effects might be less accurate.
Additional resources
- The RollingWave scene in the Water package samples.
- Shader Graph