Author: DigiBen
This tutorial builds off of the previous shadow mapping tutorial, but implements it with GLSL. Shadow mapping is a fast technique for shadowing the world with self shadowing of objects. Basically, you render the light's view to a texture stored as depth values, then you compare those depth values with the camera view's depth values that are projected into the light's clip space. Through just a quick check of distances between each value you can tell which part of the scene should have shadows and which part shouldn't. This technique is used in professional games and the movie industry. The next tutorial implements "Percentage Closer Filtering" (PCF) with GLSL.
Functions Used: glViewport(), glMatrixMode(), glLoadIdentity(), gluPerspective(), glClear(), gluLookAt(), glBegin(), glEnd(), glLightfv(), glPushMatrix(), glPopMatrix(), glNormal(), glColorMask(), glGetFloatv(), gluPerspective(), glActiveTextureARB(), glMultiTexCoord2fARB(), gluNewQuadric(), gluQuadricDrawStyle(), gluCylinder(), gluSphere(), gluDeleteQuadric(), glTexParameteri(), glTexGeni(), glTexGendv(), glLoadMatrixf(), glMultMatrixf(), glPolygonOffset(), glCopyTexSubImage2D(), glCreateShaderObjectARB(), glShaderSourceARB(), glCompileShaderARB(), glCreateProgramObjectARB(), glAttachObjectARB(), glLinkProgramARB(), glUseProgramObjectARB(), glGetUniformLocationARB(), glDetachObjectARB(), glDeleteObjectARB(), glGetString(), wglGetProcAddress(), glGetInfoLogARB(), glGetObjectParameterivARB()
GLSL Keywords: varying, uniform, sampler2DShadow, gl_ModelViewMatrix, gl_Vertex, gl_TextureMatrix, gl_FrontColor, gl_Color, gl_Position, gl_FragColor, ftransform(), shadow2DProj(), clamp()
purchase full version
Access EXE