O'Reilly logo

OpenGL Insights by Christophe Riccio, Patrick Cozzi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shadow Proxies
Jochem van der Spek
16.1 Introduction
For real-time rendering of the virtual painting machines that I regularly show in
exhibitions (see Figure 16.1), I needed a shadowing technique capable of rendering
soft shadows without any rendering artifacts such as banding or edge jitter no matter
how close the the camera came to the penumbra. I call such shadows infinitely s oft.In
addition, I wanted a method to render color bleeding so that the color and shadow of
one object could reflect onto others (see Figure 16.2). Searching through the existing
Figure 16.1. Stills from a virtual painting machine.
219
16
220 II Rendering Techniques
Figure 16.2. Still from the demo movie.
real-time soft shadow techniques [Hasenfratz et al. 03], I found that most were either
too complex to implement in the relatively short time available, or they were simply
not accurate enough, especially when it came to getting the camera infinitely close to
the penumbra. Most techniques for rendering the color bleeding required setting up
some form of real-time radiosity rendering that would be prohibitively complex and
expensive in terms of computing po wer.
Light direction
Represented
geometry
Bleeding volume
ProxyOffset
Shadow volumeMaximum volume
Figure 16.3. The volume regions of a shadow proxy.
16. Shadow Proxies 221
(a) (b)
Figure 16.4. The shadow volume of a proxy. (a) The volume without modulation. (b) The
volume multiplied by the dot product of the surface normal and light direction.
The solution came in the form of a reversed argument: if we cannot globally
model the way the light influences the objects, why not locally model the way the
objects influence the light? Given that in a diffusely lit environment, shadows and
reflections have limited spatial influence, some sort of halo around the model could
function as a light subtraction volume (see Figures 16.3 and 16.4). In order to model
directional lighting, the shadow volume could be expanded in the direction away
from the light source and contracted to zero in the opposite direction. The color-
bleeding volume could be expanded toward the light in the same manner. We call
these volumes shadow proxies,
1
because they serve as a stand-in for the actual geom-
etry. The volume of a proxy covers the maximum spatial extent of the shadow and
color bleeding of the geometry that the proxy represents. The technique is there-
fore limited to finite shadow volumes and is most useful for diffusely lit environ-
ments. This is similar to the Ambient Occlusion Fields technique by [Kontkanen
and Laine 05], although with ShadowProxies, modeling a nd modulating the shadow
volumes is done on the fly r ather than precalculating the light accessibility of the
geometry into a cubemap.
16.2 Anatomy of a Shadow Proxy
In the current implementation, each shadow proxy can only represent a simple geo-
metrical shape like a sphere, box, or cylinder, allowing quick proximity calculations
in the fragment shader that eventually renders the shadows.
An implementation that uses super-ellipsoids [Barr 81] has also been attempted.
Even though the surface lookup is fast enough to be used in real time, the method
1
The Shado wProxies technique is implemented in the OpenGL- based cross-platform scenegraph li-
brary called RenderTools, available under the GNU Public License (GPL) which ensures open source
distribution. RenderTools is available on Sourceforge at http://sourceforge.net/projects/rendertools and
through the OpenGL Insights website, www.openglinsights.com

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required