LogoBEN CLOWARD - Technical Artist
Diffuse Texture
Diffuse Texture

Normal Map
Normal Map

Ambient Occlusion Map
Ambient Occlusion

Global Illumination Map
Global Illumination

Ambient Occlusion & Global Illumination
Ambient Occlusion & Global Illumination

Complete Shader
Complete Shader


DirectX 9 or higher
- Diffuse Texture
- Normal Map Texture
- Ambient Occlusion Texture
- Global Illumination Texture (Diffusely Convolved Cube Map)
- Ambient Color

DOWNLOAD: (right click and choose "save target as...")

Global Illumination Shader  Global Illumination Shader


  • The problem with most real-time computer graphics is that lighting looks very fake. This is because the light comes from infinitely small point lights. Objects in the real world are lit by light that is bouncing in the environment and coming in from every direction. This shader attempts to immitate that type of lighting instead of using the traditional point lights.

  • I got the idea for this shader at a Siggraph session that was hosted by Dan Lemmon of Weta Digital and Paul Debevec. This shader is a simplified, real-time version of the shaders that Dan described that he was using for the characters in the Lord of the Rings movies.

  • For the lighting in this shader I use a diffusely convolved, high dynamic range image (HDRI) and convert it to a cube map. This cube map simulates light coming from every direction into each point on the model. Then I use the normal from the normal map to look up in the cube map the light that comes from the normal's direction.

  • To increase the realism, I also create an ambient occlusion map (sort of like a shadow map) for the model. In 3DS Max, I apply a second set of texture coordinates in map channel three. Then I add a skylight to the scene and use "Render to Texture" to render out a "lighting-only" texture with Light Tracer. The resulting image is an ambient occlusion map and shows the area where the model casts shadows on itself.

  • The combination of the ambient occlusion map and the global illumination cube map create very realistic looking lighting. Add in the normal map and the diffuse map and you've got a pretty good real-time version of global illumination.

  • There are some drawbacks for this shader. The one that Dan Lemmon was using would render out a new ambient occlusion map for every new frame. We can't really do that in real-time, so the ambient occlusion map only works for rigid objects that don't deform. You can still use the shader for characters, but the ambient occlusion map won't be quite as realistic.

  • Also, the global illumination map looks best for the one spot in the environment where it was created. If you apply the shader to a moving character, you need to create a new cube map for each area of your world and come up with a method for telling the shader which cube map to use based on proximity.

  • Finally, this shader has no support for dynamic (moving) light sources. That means that it won't respond to torches moving by, bright explosions, etc.

  • I've only included a short description here of how to use this shader. If you're interested in using it and want more details on how to create the diffusely-convolved cube map and the ambient occlusion map, please send me an email and I'll describe it in more detail.

  • Normal Map compression is an option that you can use with this shader. Copy the red channel of your normal map to the alpha channel. Then delete the red and blue channels and save your normal map in DXT5 DDS format. Put your compressed normal map in the DXT5 Normal Map slot for the shader. Then choose "Compressed" as the technique instead of "complete."

    Updates (11/26/05):

  • Vectors in world space to fix Max 8 lighting bug.
  • Adjusted cube map code to use DX standard cube map arangement instead of proprietary format.
  • Added option to flip the green channel in the normal map.


    For instruction on how to apply this shader to your model in 3DS Max, read my tutorial - HLSL Shaders in 3DS Max.

    For instruction on how to create normal maps for this shader, read my tutorial - Creating and Using Normal Maps.

    If you'd like to use some of my textures with this shader instead of making your own, you can find them here.


    If you have trouble getting this shader to work correctly in 3DS Max, send me an email. I'll see If I can help. Also, I'm an artist - not a programmer. If you are a programmer or know more about shaders than I do and you find something in this shader that is poorly written, broken, etc, I'd love to hear from you. I've mostly taught myself how these things work so if you have some pointers for me that would be great!!

    Return to the list of Shaders


    Free Content Sponsors: