Efficient Self-Shadowed Radiosity Normal Mapping
Chris Green∗
Valve

Normal-mapped

Normal mapped with ambient occlusion

Abstract
In Valve’s Source graphics engine, bump mapping is combined withprecomputed radiosity lighting to provide realistic surface illumination using a technique we call Radiosity Normal Mapping. Whenbump map data is derived from geometric descriptions of surface
detail (such as height maps), only the lighting effects caused by thesurface orientation are preserved and significant lighting cues due
to lighting occlusion by surface details are lost. While it is common
to use an additional texture channel to hold an “ambient occlusion”
field, this only provides a darkening effect which is independent of
the direction from which the surface is being lit.
In this chapter, we present a modification to the Radiosity Normal
Mapping system that we have described in this course in the past.
This modification provides a directional occlusion function to thebump maps, which requires no additional texture memory and isactually faster than our previous non-shadowing solution.

1Introduction

In order to increase surface detail and perceived realism, bumpmapping is used heavily in modern real-time 3D games [Blinn1978] [Peercy et al. 1997]. Bump maps are often used as an approximation of highly detailed geometry which would either be too
slow to render in real time or too memory intensive to store reasonably. However, one weakness of bump maps is that they only
modify the surface normal which is used for lighting computations.
While this provides a realistic directional lighting cue, effects suchas self-shadowing of surface details and ambient occlusion are notrendered.
Traditional bump mapping also cannot be combined with conventional precomputed light maps, a technique in which a global illumination solution is generated as a precomputation and then stored
in a low resolution texture which is used to modulate the brightnessof the surface albedo [id Software 1997].
With Radiosity Normal Mapping, the precomputed light map information was extended to encompass lighting from multiple directions and allowed arbitrary bump mapped data to be combinedwith precomputed lighting textures [McTaggart 2004] [Mitchellet al. 2006]. Using Radiosity Normal Mapping, the distributionof incoming distributed lighting can be stored in many possible
bases, with the tangent-space surface normal evaluated per pixel∗ e-mail: cgreen@valvesoftware.com

Self-shadowed

and then convolved with the incoming light distribution for each
output pixel [Sloan 2006].
In this chapter, we extend Radiosity Normal Mapping by modifying the bump map representation to be pre-convolved against thetangent-space lighting basis in order to gain efficiency and reduce
rendering artifacts. We then extend this pre-convolution to take into
account directional self-occlusion information, allowing for both
occlusion of isotropic ambient lighting and dynamic directionallighting.

2Related work

Many different techniques have been used to add shadowing information to bump mapped surfaces for real-time rendering. Horizon
mapping augments bump map data by precomputing and storing
the angle to the “horizon” for a small set of fixed tangent-space directions and uses this representation to produce hard shadows [Max1998] [Sloan and Cohen 2000]. In [Kautz et al. 2000], an oriented
ellipse is fitted to the distribution of non-shadowed lights over abump map texel. In [Oat and Sander 2007], a spherical cap is used
to model the visible light directions over a bump map texel, andthis data is used to render hard and soft shadows from point andarea lights in real time.
Recently, techniques have been developed for direct rendering ofheight fields in real time using graphics hardware [Policarpo et al.
2005] [McGuire and McGuire ] [Tatarchuk 2006]. Since these techniques are able to compute visibility of height field texels from any
viewpoint, they are also able to implement shadowing of height
fields by computing visibility to light sources.

3

Representation and Generation

We wished to implement self-shadowing of bump maps that would• mesh well with our existing Radiosity Normal Mapping technique• work on older generations of graphics hardware as well as
current systems.
• run as fast as, or faster than our current non-shadowed solution.
• improve bump map anti-aliasing

3• work with dynamics lights as well as our pre-calculated radiosity lighting• provide soft shadows and ambient occlusion• allow shadowing information to be generated either fromheight data or from arbitrary geometry.
• not use any increased texture storage space compared to ordinary bump mapping. In particular, we wanted to be able topreserve existing uses of the alpha channel of bump maps asa mask for various other effects.
We successfully implemented a method to generate diffuse softshadows from static and dynamic light sources, with no increasein bump map storage space, while providing an actual performanceincrease over our existing non-shadowed radiosity bump map implementation.
Prior to the integration of self-shadowing into the Radiosity NormalMapping technique, the Source engine calculated lighting at eachsurface pixel using the following operations:~ 0..2 =B√
 −1 −1 1  2
1
11√ , √ , √ , √ , √ , √ , √ , 0, √
62
3
62
3
3
3~~
N = 2T − 1

 −1~ ·B~ i )2
N~ i = saturate(DP2 ~Di
i=0pixelcolor = kd

2X~ iD~iL

REPRESENTATION AND GENERATIONf l o a t 3 d i f f u s e L i g h t i n g = normalTexel . x ∗ lightmapColor1 +normalTexel . y ∗ lightmapColor2 +normalTexel . z ∗ lightmapColor3 ;Figure 2: HLSL source code for new self shadowed radiosity normal mapping

normal for use to calculate the lighting from dynamic lights and reflection vectors. However, when needed, we can use our original~ to reconstruct a suitable tangent-space normal
basis directions B
for reflections. For dynamic lights, we can project the lighting direction onto our basis directions and use that directly in the lighting
equation, which gives us a form of shadowing from dynamic lightsources.
Once bump maps are stored in this format, some advantages areseen besides the increased pixel shader performance:• Because the bump maps now just represent positive light map
texture blending weights, no special processing is required
when filtering or mip-mapping them.
• Numeric precision is increased since we no longer have torepresent negative numbers and because we are now storing
the bump maps in the exact numeric representation requiredby the shader.
• Surface textures stored in this form can be processed by existing art tools with no special interpretation. For instance,filters such as sharpen and blur can be used in PhotoshopTM .

i=0

where T~ is the tangent-space bump map texel (which must be scaled~ , because the stored texels are unsigned), B~
and biased to obtain N
is the set of tangent-space directions for which incoming light has~ 0..2 are the 3 precomputed lighting values, andbeen precomputed, L
kd is the RGB albedo of the surface texel being lit. saturate(x) is theHLSL function which clamps its input to be in the range between 0and 1.
f l o a t 3 normal = 2.0 ∗f l o a t 3 dp ;dp . x = s a t u r a t e ( d o t (dp . y = s a t u r a t e ( d o t (dp . z = s a t u r a t e ( d o t (dp ∗= dp ;normalTexel − 1 . 0 ;normal , bumpBasis [ 0 ] ) ) ;normal , bumpBasis [ 1 ] ) ) ;normal , bumpBasis [ 2 ] ) ) ;f l o a t sum = d o t ( dp , f l o a t 3 ( 1 . 0 f , 1 . 0 f , 1 . 0 f ) ) ;f l o a t 3 d i f f u s e L i g h t i n g = dp . x ∗ l i g h t m a p C o l o r 1 +dp . y ∗ l i g h t m a p C o l o r 2 +dp . z ∗ l i g h t m a p C o l o r 3 ;d i f f u s e L i g h t i n g / = sum ;Figure 1: HLSL source code for original Source Radiosity Normal
Mapping
We observed that some execution time could be saved if, instead~ in our texture maps, we stored theof storing the surface normal N~ in the 3 color components of the bump map, which was avalue of D
trivial modification to our bump map generation utility. PThis change
2~ i T~i .
reduced the lighting equation to just pixelcolor = kd i=0 L
Just making this change saves a substantial number of pixel shader
instructions. However, we no longer have a tangent-space surface• Texture blending for operations such as detail texturing, texture cross fading, etc. are much more straightforward.
• Fewer aliasing artifacts will be seen when textures are minimized.
• Textures in this format can be directly generated from geometry in 3D rendering packages, by placing red/green/blue unshadowed point lights in the scene, offset along the 3 predefined basis vectors.
Ordinary bump maps can only change the apparent lighting orientation of the surface. However, when rendering with this representation, if we uniformly scale the RGB values of the normal map
texels, we can provide a darkening effect which is independent of
the lighting direction. This allows us to have normal maps also
act to modulate surface albedo, without having to store a separate
brightness channel, or change the RGB values of the base albedo
texture. Since it is often possible to produce good imagery by combining a fairly low frequency albedo texture with a high frequency
bump map texture, this can save us texture memory.
A common bump map production method involves taking elevation maps which are either painted, created in a modeling package,or acquired from real-word sources, and then using these elevation
maps to extract a surface normal. Then, the same elevation data isused to calculate an ambient occlusion channel, which is typicallygenerated by firing from each texel, a large set of rays. The resultsof these ray intersections are used to determine the cosine-weighted
proportion of the hemisphere above the surface which can be seen
without the surface obscuring it. The result of this ambient occlusion calculation is then either stored in its own texture channel, ormultiplied into the base texture. We can do the exact same thing in
our representation, except that we can encode this channel directly
into the 3 channel normal map.

c 2007 Valve Corporation. All Rights Reserved

REFERENCES

Height map

Bump map

Bump map stored in new basis

With directional ambient occlusion

Moreover, since each of the channels of our modified bump map
store the amount of light coming from 3 fixed tangent-space directions, we are able to do better than just encoding ambient occlusion.
If we weight the contribution of each ray intersection test based
upon the dot product between it and the fixed tangent-space direction associated with each channel, we can calculate a separate occlusion value for each channel, with that occlusion value representing a smaller angular distribution centered upon the corresponding
basis vector. This gives us a “directional ambient occlusion” effectwhich causes ambient and direct lighting arriving from different directions to be darkened when that light would have been blocked
by the self-shadowing effects of the surface. These 3 ambient occlusion directions are simply multiplied into the 3 channels of thenon-shadowed bump map we are already using in our representation. This gives us a form of diffuse self-shadowing essentially “forfree,” providing self-shadowing of direct and indirect light.
When these directional ambient occlusion textures are converted
back into normal vectors for reflection calculations, something akinto the use of “bent normals” is achieved [?].
We implemented an efficient multi-threaded SIMD ray tracing system [Wald et al. ] in order to perform the hundreds of ray intersection tests per texel necessary to generate accurate directional
ambient occlusion. Our offline utility takes as input an elevation
map and an elevation scale factor. A user-configurable bilateral filter [Tomasi and Manduchi 1998] is applied to the input image toreduce stair-stepping, and then 300 rays per output texel are traced
in order to generate bump maps with directional ambient occlusion
in our new format.
It is also possible to generate textures in this format through standard 3D rendering packages, by the careful placement of area lights
in the scenes. Analogously, such maps could be captured from realworld materials via photography with appropriately placed lights
and reflectors.
The standard techniques for generating bump maps for a coarsely
tessellated model by tracing rays against a more finely tessellated
one can be easily extended to support this bump map representation, which will allow for animated articulated models with selfshadowing surface detail.
We can easily extend this technique to support more channels inorder to produce more accurate lighting and shadows, at the expense of higher texture storage. Differing combinations of sample directions and lighting precomputation directions can be used,
for instance to provide more accurate shadows from dynamic lights
without increasing the storage needed for light maps.

Figure 3: Cave walls exhibiting self-shadowing from the flashlightin Half-Life R 2: Episode 2.

4Conclusion

A form of self-shadowing can be easily added to radiosity bumpmapping by “baking” the light sampling basis into the actual bump
map data, with no decrease in performance or increase in texture
memory cost. We are able to make heavy use of this technique inthe games Half-Life R 2: Episode 2 and Team Fortress 2.

References
B LINN , J. F. 1978. Simulation of wrinkled surfaces. In SIGGRAPH’78: Proceedings of the 5th annual conference on Computer
graphics and interactive techniques, ACM Press, New York, NY,USA, 286–292.
ID S OFTWARE , 1997. Quake 2.

K AUTZ , J., H EIDRICH , W., AND DAUBERT, K. 2000. Bump map
shadows for OpenGL rendering. Tech. Rep. MPI-I-2000-4-001,Max-Planck-Institut für Informatik, Saarbrücken, Germany.
M AX , N. L. 1998. Horizon mapping: shadows for bump-mappedsurfaces. In The Visual Computer, 109–117.
M C G UIRE , M., AND M C G UIRE , M. Steep parallax mapping. I3D2005 Poster.
M C TAGGART, G., 2004. Half-life 2 shading. GDC Direct3D Tutorial.

c 2007 Valve Corporation. All Rights Reserved

REFERENCESREFERENCESM ITCHELL , J., M C TAGGART, G., AND G REEN , C. 2006. Shadingin valve’s source engine. In SIGGRAPH ’06: ACM SIGGRAPH
2006 Courses, ACM Press, New York, NY, USA, 129–142.
OAT, C., AND S ANDER , P. V. 2007. Ambient aperture lighting. In
I3D ’07: Proceedings of the 2007 symposium on Interactive 3Dgraphics and games, ACM Press, New York, NY, USA, 61–64.
P EERCY, M., A IREY, J., AND C ABRAL , B. 1997. Efficient bumpmapping hardware. Computer Graphics 31, Annual ConferenceSeries, 303–306.
P OLICARPO , F., O LIVEIRA , M. M., AND C OMBA , J. L. D. 2005.
Real-time relief mapping on arbitrary polygonal surfaces. In
I3D ’05: Proceedings of the 2005 symposium on Interactive 3Dgraphics and games, ACM Press, New York, NY, USA, 155–162.
S LOAN , P.-P. J., AND C OHEN , M. F. 2000. Interactive horizon mapping. In Proceedings of the Eurographics Workshop
on Rendering Techniques 2000, Springer-Verlag, London, UK,
281–286.
S LOAN , P.-P. 2006. Normal mapping for precomputed radiancetransfer. In I3D ’06: Proceedings of the 2006 symposium on
Interactive 3D graphics and games, ACM Press, New York, NY,USA, 23–26.
TATARCHUK , N. 2006. Practical parallax occlusion mapping withapproximate soft shadows for detailed surface rendering. In SIGGRAPH ’06: ACM SIGGRAPH 2006 Courses, ACM Press, New
York, NY, USA, 81–112.
T OMASI , C., AND M ANDUCHI , R. 1998. Bilateral filtering forgray and color images. In ICCV, 839–846.
WALD , I., B ENTHIN , C., WAGNER , M., AND S LUSALLEK , P.
Interactive rendering with coherent ray tracing.

c 2007 Valve Corporation. All Rights Reserved