Shallow Water Simulation#
A Shallow Water Simulation is a versatile tool which simulates fluid dynamics in shallow water. Generally speaking it has many use cases from emergent gameplay with turbines and pumps to generating streams. At launch only the stream and shoreline use case is supported.
The simulation will inject water height, foam and flow to give convincing results.
Warning
Like any simulation it can be difficult to control and thus expectations should be tempered. For example if you have a vision for what kind of shoreline waves you want, the terrain will have to be authored to produce that output with the simulation. Furthermore, depending on the riverbed, some streams will not reach the end.
Usage#
To get started perform the following:
Add the ShallowWaterSimulation component
Add a Depth Probe
Set the transform X/Z scale to match the Width property
Move the transform to the center of the simulation
Click “Populate Depth Probe & Reset Simulation”
After changing a property you will need to click “Reset Simulation” for them to be reflected. Changing properties when the simulation is running can cause instabilities and visual anomolies - this is expected and just click “Reset Simulation” when ready.
Stream Simulation#
The Stream preset can effectively simulate a stream and the result can be baked to a texture.
This simulation is a function of water level and thus the Inject property (
) needs to be set to Level. Then you will need Water Level Input’’s as the input source. When you raise the Water Level Input it will expose a wall of water and this will be the source of water for the simulation. Water will flow out of this wall.Example
See the Stream sample for an example of connecting two lakes with a stream.
Once everything is set up, let the simulation run. The simulation can be baked at any point, but the best time is when water has found its level (ie no more movement in water height - ignore flow movement). Click “Bake Output” to bake the simulation at which point the Mode will change to Baked and you will see the Baked Texture slots populated.
Warning
It is possible that the stream will not reach its destination depending on the amount of obstructions and the profile of the terrain.
Shoreline Simulation#
The simulation can be combined with normal waves to simulated shoreline wave behaviour.
This simulation is a function of displacement (ie Animated Waves simulation) and thus the Inject property (
) needs to be set to Waves. Properties to control this simulation is found under the heading.This is a realtime effect and cannot be baked.
Example
See the Beach sample for an example of simulating a Swash Zone.
Warning
Results will greatly depend on the profile of the terrain and the waves.