This example makes use of the
shadow generation of PowerSGL to simulate a varying light source - in this case a
flickering candle flame in a simple room containing some furniture. The room model consists of a polygon mesh (4 walls and a floor), which
contains a table, two stools, a shelf, and a candle. The furniture is modelled using
convex objects. Constructing these items from convex pieces allows PowerSGL to
automatically generate shadow volumes from given a light source.
The position of the light and the texture mapped
"flame" are both controlled by the same transformation matrix, so that the
random motion of the flame automatically generates the correct change in the shadows.
The translucent texture used to represent the flame is also
modified, along with the intensity of the light source and the 'glow' colour of the flame.
The technique could be adapted for more dramatic effects such
as the light cast from a fireplace, or sudden flash of lighting. |