3

II

Volumetric Real-Time Water and

Foam Rendering

Daniel Scherzer, Florian Bagar, and

Oliver Mattausch

3.1 Introduction

Over the last decade, simulation and rendering of complex natural phenomena

such as ﬁre, smoke, clouds, and ﬂuids have been an active and most diverse

research area in computer graphics. Among these phenomena, water may be

the most fascinating and challenging problem, due to the familiarity that even a

Figure 3.1. The proposed algorithm allows water to be rendered in many ways.

119

120 II Rendering

casual observer has with the phenomenon. Although the visual quality of water

rendering is continually improving, we are still a long way from capturing all the

physical properties of real water, like the forming of foam and droplets and their

interaction with the environment.

In this chapter we present a method for creating a fully dynamic multilayered

real-time water rendering approach. This approach can represent the volumetric

properties of water and the physical formation of volumetric foam, thereby creat-

ing much higher visual ﬁdelity than previous real-time approaches. It is based on

a very fast particle-based ﬂuid simulation that is fully hardware-accelerated using

Nvidia PhysX and rendering in OpenGL, and therefore easily runs at real-time

frame rates. The algorithm has a small memory footprint and is simple to imple-

ment and integrate into existing rendering engines. Additionally, our method is

highly conﬁgurable from an artistic point of view, and thus can produce a multi-

plicity of visual appearances to help to create the desired atmosphere for a scene

(see Figure 3.1).

3.2 Simulation

In order to render believable water, we ﬁrst have to simulate its behavior. The

dynamics of water as an incompressible ﬂuid can be described by a version of

the Navier–Stokes equations, which apply Newton’s second law (conservation of

momentum) and conservation of mass to ﬂuid motion. These equations relate the

body forces (gravity) and the contact forces (pressure and stress) that act on a

ﬂuid. This results in nonlinear partial diﬀerential equations that are very hard to

solve (assuming that an exact solution for a given case even exists). As we do not

need an exact solution, but are mainly concerned with speed, we are ﬁne with an

approximate numerical solution. Approximations in this problem domain mainly

use Euler integration. (There are more accurate methods, such as Runge-Kutta

or midpoint, but these take more time to evaluate.)

3.2.1 Smoothed-Particle Hydrodynamics

Smoothed-particle hydrodynamics (SPH) is a robust and fast way for simulat-

ing the behavior of water [Desbrun and Gascuel 96]. The main idea here is to

approximate a ﬂuid by a particle system (a division of the ﬂuid into discrete

elements) to calculate its dynamic behavior. Each particle has a mass and ad-

ditional properties, such as position, density, velocity, and lifetime. In classic

particle systems, each particle is updated based only on its properties, disregard-

ing particle-particle interaction for the sake of speed. For the simulation of ﬂuids

this will not suﬃce because of the contact forces. Each particle can potentially

aﬀect all other particles, which results in a computational complexity in the order

of O(n

2

)—too slow for practical purposes if we use tens of thousands of particles.

Start Free Trial

No credit card required