Monday, April 25, 2022

VRAGE: Volumetric Water


  • Research on our new VRAGE 3 engine has started
  • VRAGE Water
    • Planetary scale (or small pond)
    • Volumetric 3D (no 2D plane or height field)
    • Flow simulation, arbitrary gravity
    • Buoyancy, pressure, surface tension and more
  • Overview of existing technologies 
  • Examples of work-in-progress experiments & next steps

Guest post by Petr Minařík, Senior Lead Programmer at Keen Software House

Hello, Engineers!

VRAGE™ is an in-house game engine developed by Keen Software House. VRAGE stands for “volumetric rage” and/or “voxel rage”.

VRAGE’s core feature is volumetricity within the environment. Volumetric objects are structures composed from block-like modules interlocked in a grid.

Volumetric objects behave like real physical objects with mass, inertia and velocity. Individual modules have real volume and storage capacity and can be assembled, disassembled, deformed and destroyed.

For our next generation of the VRAGE engine (VRAGE 3.0) we have started research of water and its simulation. Our expectation is that water will become a major part of available gameplay features in our future games. Our current research goal is to support the realistic behavior of volumetric water, while maintaining good performance and visual quality.

For a more detailed look at our research on VRAGE “Volumetric Water”, please watch the video below:

Feature requirements

Any kind of simplification like plane or sphere approximation is a no go for us. Any simplification like that reduces player possibilities of interactivity.

Volumetric water must be simulated with all possible natural phenomena, on planetary scale, creating flows like rivers and waterfalls, all while still being interactive and allowing players to to fully interact with and manipulate it.

These are the features we consider as a top priority:

  • Volumetricity - fully 3D simulation, no 2D planes or height fields
  • Flow simulation - with an arbitrary gravity, throughput based on hole size, mass conservation
  • Buoyancy - Archimedes principle, hole detection, ship sailing
  • Scale - from a small pond to a water planet
  • Pressure - level equalization, high hydrostatic pressure at high depths
  • Surface tension - water creates globules in zero gravity

There are many features we might consider, like air pressure simulation, inner flows, vortices, viscosity, water color, gas / air tightness, lava, acids, moving sands, siphoning, AI simulation, and many others.

Existing technologies

There are basically two main approaches used for liquid/fluid simulation. Both of them attempt to simulate water based on famous Navier-Stokes equations describing flow of incompressible liquids.

Smoothed particle hydrodynamics (SPH)

Based on simulation of a high amount of small particles. By their interaction with each other the effect of flowing liquid is created.

Source: Github - SPlisHSPlasH

  • Physical behavior (velocity, gravity, collisions)
  • Realistic visuals
  • Lots of existing GPU implementations
  • Better suited for exact simulations

  • Computationally extensive
  • Unstable - more sensitive attributes
  • Difficult to scale
  • Surface tracking

Cellular automatas (CA)

Grid based simulation where there is a mass and physical properties in every cell. Every cell interacts with its direct neighbors and this creates the effect of a “flow”. 

Source:.jgallant - 2d-liquid-simulator-with-cellular-automaton-in-unity

  • Fast & simple, stable
  • Easy to parallelize
  • Already used in games (Minecraft, Ylands)

  • Axis aligned - Water surface & vertical gravity immutable
  • Sand like issues - “Water piling”
  • Complicated collisions with dynamic objects

Combinations of particle and grid based approach

Unfortunately, all the above research tends to simulate either fast limited fluids, or slow high-quality simulations. Although they look great, they focus on offline rendering (movies, static images) and a limited scale of simulation (basins, aquariums). Large scale simulations are simulated with approximation approaches like height cells or shallow water simulation. 
  • PIC - Particle in cell
  • FLIP - Fluid implicit particle
  • MAC - Marker and cell grid
  • MLS MPM - Moving Least Squares Material Point Method
Source: Redsharknews

Source: UCLA Mathematics

VRAGE Water - Our solution

We would like to present you our solution, which is based on ongoing research and prototypes we have created. It is far from a final implementation but it already contains some expected behavior and it is even fun to play with.

Combination of particle and grid based approach

We use Center of mass (COM) in every cell, which can also be seen as one particle per cell. These are main properties of our system:
  • Grid based simulation
  • Velocity introduced to the cells to increase realism
  • Center of mass (COM) introduced to avoid unwanted diffusion
  • Compatible with voxel approach used in current VRAGE engine 

Every cell has these physical properties:
  • Mass
  • Velocity (calculated from forces)
  • Center of mass (COM)
We found this technique to be so far the great compromise between features we need and a performance of the algorithm.

Example: Cells with indicated center of mass and velocity

Fluid simulation forced to behave as liquid

These principles are similar to those used in fluid simulation. We use proper forces to keep the “fluid” liquid and simulate water behaviors.
  • Gravity + tension forces can keep the fluid in a liquid state
  • Pressure forces adjust water compression (Water Pressure)
  • Surface tension to create nice globules
  • Constant expansion/diffusion. If not limited, liquid can spread around.
  • No maximum mass cell limit

To be able to correctly simulate surface equalization with pressure, we had to make our water compressible. That means the deeper the cell is, more water is stored in the cell.

Basic algorithm steps

First cell velocities are calculated from forces applied to cells. Then an advection step is executed where diffusion for every cell is applied. After these calculations, new values are copied to the content buffer.

VRAGE Water - Forces

To simulate the basic natural phenomenons we use these forces:
  • Gravity 
  • Pressure
  • Surface tension
There is an indefinite amount of other forces possible, like friction/viscosity, thruster forces, wind, pumps, turbines.. Each of them adds more immersivity and natural behavior to the water, on the other hand it increases the performance cost of the algorithm.

Example: Interaction with mouse cursor - attracting and distracting force


Gravity is a point centric force with different direction per cell. We need to consider all special cases which can appear in our games, thus our requirements for gravity are very similar to natural force.
  • Gravity is dynamic and is different at different positions in the world
  • It is non-linear and not aligned to any axis
  • There can be no gravity at all
  • Gravity center can be inside of a water pool
Example: Water follows gravity center and creates a globule around it

Example: Velocities aligned along gravity force


Pressure force determines water volume distribution, it tries to keep the amount of water in every cell the same. The result of this force is that water is not squeezed into several cells and it fills empty spaces much quicker, including situations like U-bend etc.
  • Pressure distributes liquid in cells to keep same threshold
  • Pressure helps liquid to get into places where water should naturally flow
  • If there is no pressure, all water is compressed into several cells
  • This force is not a hydrostatic pressure
  • Air pressure is not considered
  • Our water is compressible
    • + it gets to proper level very fast
    • - it takes a huge amount of water in depth
Example: Water equalization in an U-bend

Surface tension

Surface tension is a force pushing against the water surface to keep the water in the globule shape. This effect is the most visible in zero gravity, where it creates nice dynamic blobs.

Source: NASA

With surface tension the behavior can sometimes also mimic water blobs on the window glass.

Example: Surface tension creating globules in zero gravity

Example: Velocities aligned to surface tension force

VRAGE Water - Diffusion

Thanks to grid based algorithm it is very easy to find neighbors to every cell. Every iteration the water is spread to these neighbors by an amount given by diffusion radius. With diffusion we can easily simulate phenomenons like mist, steam or gas. The principles of diffusion are:

4 Directions (Up, Down, Left, Right)
If not limited, water always evaporates into mist
Expansion only to direct neighbors
Amount is determined by diffusion radius

Example: Diffusion with no velocity

The spread area center is given by COM and the cell velocity, where COM is the start of the vector and the end of the vector is the center of diffusion area.

Example: Diffusion with velocity

Example: Water drop expands to empty area, as no forces are applied

VRAGE Water - Work in progress

All presented content is work in progress and subject to change. Currently our goal is to scale up water simulation to planetary level. For the prototype we use accelerated octree structure for solids and manual level of details (LOD) for the water.

Example: Comparison scale on planetary level

Example: Manula water LOD switching

During the development there are also some unexpected situations where you introduce not planned behavior. Check out the most interesting ones!

Example: Viscous water - lava, honey, melted iron...

Example: Boiling water

VRAGE Water - Next steps

We continue improving large scale water simulation, which includes more sophisticated methods of LOD switching, arbitrary grid resolution etc. It is possible to combine more water optimization techniques together. Next priorities for us are:
  • Lodding, large scale simulation, concealment
  • Surface generation / marching cubes
  • Buoyancy
  • Moving to 3D space

Follow our social media to get the latest news!

We are always impressed by the innovation of our modding community! We would like to thank the Space Engineers community for continuing to inspire us through their ideas, suggestions, and hard work.


If you’re interested in working on awesome games like Space Engineers, we’d love to hear from you!
Check out the open positions at Keen Software House and don’t forget to send us your English CV/resume and cover letter.

Remote collaboration is possible!

Our team is global.

Finding the best candidates to join Keen Software House means exploring every possible solution, including remote work. While we strive to provide team members with the best possible work-life balance here in Prague at our incredible Oranzerie offices, we understand that it is not always possible to transition, therefore we are very remote friendly. Here’s a map of where our teammates live.


Thank you for reading this blog!

Petr Minařík
Lead Programmer at Keen Software House

For more news:
Vrage Engine:
Space Engineers:
Keen Software House:
Medieval Engineers:
General AI Challenge:

Personal bio:

Petr Minařík is lead programmer at Keen Software House, an independent game development studio best known for its best-seller Space Engineers (over 4 million copies sold). Petr is a former leader of the team who successfully developed and released Space Engineers, and who developed the most important parts of its codebase.
Petr has been interested in programming since his childhood, when he earned money by gathering old paper and bought Didaktik Gama, national clone of ZX Spectrum. He spent three years in 2K Czech working on Mafia 2 at various programming positions until the game was released. Then he started to work in Keen Software House with Marek Rosa on his game Miner Wars and during the last 11 years he has helped make Space Engineers unforgettable and the company famous. Petr loves solving challenging problems, especially those which everyone says it is impossible to solve.
At this time, Petr is working on the next generation of VRAGE engine, focused on liquid and fluid simulation.

No comments:

Post a Comment