Steps for Hardware Shadow Mapping Using OpenGL 1. Create an empty depth texture 2. Set it up with an internal format of GL DEPTH COMPONENT 3. Set the GL DEPTH TEXTURE MODE to GL LUMINANCE (so it stores the depth internally with a single luminance value) 4. Enable the depth buffer 5. Render scene from the light 6. Copy the depth buffer into the texture using glCopyTexImage2D(. ..) 7. (Optional) Display texture to check that everything so far has worked 8. When we project the shadow map onto the scene, we need to compare the texture with the distance to the light we’ll compute at each pixel. Tell OpenGL how to do this comparison by setting (using glTexEnvi(. ..)) the parameter GL TEXTURE COMPARE FUNC to GL LEQUAL. 9. Tell OpenGL what we want to compare on a per-pixel basis. Set GL TEXTURE COMPARE MODE to GL COMPARE R TO TEXTURE. 10. Tell OpenGL what sort of texture generation to use: • glTexGeni( GL S, GL TEX GEN MODE, GL EYE LINEAR ); • glTexGeni( GL T, GL TEX GEN MODE, GL EYE LINEAR );
This is the end of the preview. Sign up
access the rest of the document.
This note was uploaded on 02/17/2008 for the course CS CG taught by Professor Wyman during the Spring '08 term at University of Iowa.