Dynamic Simulation

How to add a Dynamic Water Simulation Zone: right click in the Hierarchy window -> Effects -> KWS Water -> Dynamic Water Simulation Zone

This will automatically add:

  • A water settings module with default global water settings (if not already present)

  • A dynamic simulation zone (for shallow water equations)

  • A flow source effector (used for rivers, waterfalls, etc.)

Once placed, the river starts flowing based on terrain elevation and dynamic objects. You can move, resize, or rotate the zone to define where and how the water flows. You’re now ready to see dynamic water in action — flowing, reacting, and interacting with your scene!

For detailed parameters, see Dynamic Simulation Zone Settings


How the Simulation Works

KWS2 doesn’t simulate real volumetric water. Instead, it uses a single continuous water mesh that covers the simulation zone. The simulation modifies the vertical position of each vertex in the mesh, creating the illusion of water flowing over terrain.

The algorithm works on the same principle as when you paint terrain using a heightmap. When you paint with a brush and create a hill or a pit, the water algorithm works similarly, creating a water surface in real time using a heightmap.

This approach enables water to:

  • Bend around rocks and geometry

  • Fill rivers, lakes, and basins

  • React to dynamic objects and collisions

All while remaining GPU-efficient and scalable. This method is often referred to as 2.5D heightfield simulation — it tracks surface height only (not full fluid volume).

The algorithm runs on a 2D grid mapped to the simulation zone. Each grid cell stores:

  • A single height value (Y)

  • Velocity in X and Z directions

It’s called 2.5D because it simulates horizontal flow and vertical height — but not vertical movement like falling or splashing.

Flow behavior is driven by two key principles:

  • Gravity-like rules — water moves toward lower surfaces

  • Velocity-based forces — objects or emitters can push water in any direction


Surface Interaction

  • The water surface conforms to scene depth from terrain and geometry

  • The system uses a depth texture captured when the zone is created or during baking

  • Water flows into dips and around terrain obstacles naturally

  • Zones must intersect with terrain or geometry — otherwise the simulation has nothing to react to

If you place a zone above a cave without touching the cave floor, it will ignore the geometry Best used when you want the water to "know" the shape of the object and flow around it.

  • The simulation system only "sees" surfaces it intersects from outside, not internal geometry. This means that for accurate flow behavior (especially in caves or multi-level structures), the top of the simulation zone must intersect visible terrain or geometry at the location of the water flow. For example, placing a zone above a cave without touching the cave floor will cause the simulation to ignore it entirely. Make sure your simulation zones always intersect the actual environment where the water is expected to move.


Dynamic Interaction with Objects

KWS2 supports multiple interaction types through the KWS_DynamicWavesSimulationEffector component. These objects inject data into the simulation grid and modify how water behaves around them.



Advantages

  • Fully GPU-driven — no CPU cost for simulation

  • Procedural behavior — no splines or baked paths needed

  • Real-time flow adaptation — instantly responds to terrain and forces

  • Scalable — simulation zones are culled and updated based on distance

  • Visual realism — foam, wet surfaces, shoreline detection included

  • Flexible — you can add water zones anywhere dynamically


⚠️ Limitations

  • No vertical simulation — water doesn’t fall, only spreads across a surface

  • No fluid pressure

  • Resolution-dependent — simulation detail tied to texture resolution and zone size

  • Z-fighting risks — if mesh is too close to the terrain, visual glitches may appear

  • Depth Visibility Limitation The simulation relies on scene depth (captured from the zone’s top-down orthographic camera) to determine where water flows. If your simulation zone covers enclosed geometry like a cave or building, it will not “see” inside — water will flow over the outer shell instead. To simulate water inside such areas, lower the simulation zone so it intersects the internal geometry and ensure it’s visible to the zone camera (i.e. not occluded).

Last updated