
3. Volumetric Real-Time Water and Foam Rendering 129
3.3.5 Volumetric Compositing
The difference between the usual compositing of layers and volumetric composit-
ing is that we take the thickness of each layer into account to attenuate a viewing
ray. Compositing along a viewing ray back to front, we have (see Figure 3.2):
C
wb
= lerp(c
fluid
, C
background
, e
−T
wb
)
,
C
foam
= lerp(c
fb
, c
ff
, e
−T
f f
),
C
f
= lerp(C
foam
, C
wb
, e
−T
f
),
C
wf
= lerp(c
fluid
, C
f
, e
−T
wf
),
where c
fluid
is the water color and c
ff
and c
fb
are two user-defined colors that
are blended together to create more freedom in designing the look of the foam.
After attenuation, we calculate highlights at the front ...