Simon’s Graphics Blog

Really Old Demos - Cubic Shadow Mapping

· Read in about 2 min · (280 Words)
DirectX demo code

This demo is just here for posterity - it formed part of my August 2002 coding portfolio when I was first applying for jobs in the games industry. Be warned, there‚Äôs some seriously dodgy coding going on here…

Cubic Shadow Mapping

This demo shows a variation on shadow mapping using cube maps and pixels shaders to all shadowing from omnidirectional light sources.

Screenshot

The screenshot shows a torus knot rendered using a cubic shadow map for each point light source in the scene, showing that shadowing can occur all around and even inside the object. The light used is a per-pixel attenuated point source and each object in the scene is fairly low-poly with a normal map for a bumped diffuse response.

Because there is currently no hardware support for cubic depth maps, the shadow mapping is done in pixel shaders using the alpha channel of a cubic environment map, and then each light is blended into the scene using the frame buffer alpha channel. This adds an overhead of 8 passes per light per frame, which I hope explains why there are only 2 lights in this scene. :)

Downloads

This application requires Windows 2000/XP, DirectX 8.1 and GeForce3 card or above with the latest nVidia drivers.

cubicshadows-binary.zip

The source code requires Visual Studio 7 and the DirectX 8.1 SDK to compile. The textures required for the demo aren”t included in the zip; download the binaries to get the textures.

cubicshadows-source.zip

In addition, you will need the nvidia shader assembler which is used to compile vertex and pixel shader assembler from within the IDE. You can download nvasm here.

Acknowledgements

Comments