Tackling the Challenges of Rendering Liquids in 3D


Article by Yuri Ilyin
Water. A transparent, tasteless, odorless, and nearly colorless chemical substance, covering 71% of our planet's surface; the main constituent of the fluids of all known living organisms... and one of the 'Holy Grails' in 3D graphics. In its liquid form, it is notoriously difficult to handle for a variety of reasons. And when it comes to creating convincing VFX in film or other media, every successful case is a major win for the studio involved.
Why is it so difficult?
Water is rarely static; its surface is highly reflective, and it affects light passing through it, i.e. it refracts light and, depending on the chemicals present, may also color it.
In the physical world the appearance of liquid water may be extremely diverse, and for every variation a different approach is necessary.
The easiest scenario for visualization in 3D would be a limited body of relatively still, clean water, like a swimming pool. There would be only some ripples on the surface and no interaction with other objects. such bodies of water, and a set of best practices for this already exists.
Reference: Enscape3D
In very simple terms, for cases like this an animated displacement map, a convincing material and the efficient tools for displaying water caustics on the bottom would be just enough.
And the most challenging situation? Blending CG water with real water during the post-production stage of filmmaking comes to mind here.
The crew has shot a challenging scene with real water and actors interacting with it. But upon reviewing the results, the director and/or producer feel that the drama needs to be amplified - because, surprise! - natural water doesn't always behave as desired. That's where the VFX professionals come in.
They would require robust tools to simulate the physics while retaining precise control over its motion - which is a double challenge. Besides, it is necessary to ensure that CG water blends perfectly with the real one in the shot, so the CG lighting and camera movements must be matched exactly. That is a tremendous amount of work.
The simulation of physical phenomena like fluids are typically computationally intensive. Despite the massive increase in computation power over the last decades, quality demands increase as well, so the problem persists.
Methods
Various methods of simulating liquid exist, and there are mountain ranges of both physics and data science behind them, and the field keeps advancing.
Among the most methods used are grid-based and particle-based simulations, as well as the Lattice-Boltzmann method.
Grid-based simulations are more accurate, but slow; particle-based solutions work faster but less convincing visually.
Either way, both of these methods rely on approximate solutions to the Euler equations or Navier-Stokes equations, which govern real-world fluid physics.
Approximations are acceptable as long as they deliver a qualitative visual behavior of a fluid, which is a bit more important than absolutely correct physics.
There are other methods like sine wave summing based and Fast Fourier Transform (FFT) based methods.
Interestingly, the paper linked above says that James Cameron's 'Titanic' film extensively utilized FFT-based methods for simulating water in CG shots. Since it is a very old paper, it mentions that these methods can only be used on CPU, not GPU. But it's no longer the case: there are multiple solutions capable of accelerating Fast Fourier Transforms on GPU these days.
Practical tools
On the more practical level, there are numerous software solutions that implement fluid animation techniques.
RealFlow is a well-known standalone solution that can also be integrated with Cinema 4D, Autodesk Maya and 3ds Max. It has been prominently used in films such as The Avengers, The Great Gatsby, Ice Age 4, and Resident Evil: Retribution.
Reference: RealFlow
The almighty Houdini offers several different methods for simulating liquids such as water, mud, lava, etc. Among the known use cases are the films Clash of the Titans, Prince of Persia and, more recently, James Cameron's Avatar: The Way of Water, where Weta FX studio utilized Houdini to create water and fire-related VFX.
As it is always the case with Cameron's films, the VFX studios involved push the bar in visual effects higher and higher. In The Way of Water Weta FX was responsible for creating a vast amount of CG water in various forms and invested heavily in R&D for fluid solvers within their in-house simulation tool, Loki.
Reference: WetaFX
Another significant achievement was creation of motion capture rigs that worked both underwater and above the surface. Among other things, they used countless white balls in the water to delineate between the above-water and below-water volumes. There is a great and amusing article on this at Befores and Afters, featuring the process in depth.
Autodesk Maya has its own Fluid Effects tool, and in addition, there is the Bifrost Fluids simulation system for Maya, which uses the FLIP (Fluid Implicit Particle) solver.
Reference: neroblack_NB
Bifrost also includes BOSS (Bifrost Ocean Simulation System) which emulates the ocean surface, including waves and foam.
Among the prominent users of Bifrost are VFX studios such as Pixomondo, which worked on House of the Dragon, Shazam! Fury of the Gods, Ant-Man and The Wasp: Quantumania, and Crafty Apes (Star Trek: Discovery, Tulsa King).
Reference: Pixomondo
Similar tools exist for Blender. Its default system is the Mantaflow framework, a simulation tool for creating both liquid and gas/smoke effects. However, there is a paid alternative, FLIP Fluids, which is used for liquids only. Both Mantaflow and FLIP Fluids utilize the same approach as Maya's Bifrost Fluids, though each implements it in different ways. FLIP Fluids is very popular, despite being relatively costly, at least within the Blender ecosystem.
Reference: FLIP Fluids
A relatively recent entry, Cell Fluids, is yet another third-party addon that relies on the almighty Geometric Nodes system in Blender. Developers refer to it as a '2.5D' simulation since 'it is based on the scenes height field and simulated on a 2D grid mesh with displacement applied to it.' Its still quite convincing:
Reference: Cell Fluids
There is also an ocean simulator for Blender, which is quite different from the actual simulation of water. It is primarily intended to visualize the surface only. YouTube hosts quite a few videos with clickbait titles like 'Create an Ocean in 1 Minute.' However, to achieve results that actually look good, one should expect to spend hours or even days tweaking settings, materials, baking procedures, and so on.
Computationally 'ocean simulators' are far less demanding, of course, since they don't involve much of a physical simulation. But they still may require an above-average rig to get something visually convincing.
So, overall, there is a huge variety of available tools for displaying fluids - water is just one of them - in a multitude of contexts, ranging from ultra-realistic and physically accurate fluids to something stylized yet still believable.
Learning these tools may not be a cakewalk, and using them often requires an investment in computational and rendering capabilities. But once you see an enjoyable result, it becomes clear immediately that it was totally worth it.
Unreal 5+
This is an impressive plugin by a sole developer.
It's worth mentioning here because it is based on an advanced water simulation system powered by 2D shallow-water physics that delivers realistic and dynamic fluid behavior.
Free demo in the link