previous |  up  | next
 

PCF Shadow Mapping with GLSL   

Author:  DigiBen

This tutorial builds off of the previous GLSL shadow mapping tutorial and implements "Percentage Closer Filtering".  Percentage Closer Filtering, or PCF, takes some surrounding depth values in the shadowmap and adds them up, then dividing by the number of samples taken to create an average.  This average will then be the current shadow value for that pixel.  This technique gets rid of aliasing around the edges of the shadowmap.  We use a 3x3 kernel, which means that we only take 8 surrounding pixels, including the middle pixel, to create the average.  The effect creates blurring around the shadow.  The more samples you use the better the quality and less aliasing you see.

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(), shadow2D(), clamp()


purchase full version
Access EXE

 
 
 

 

 

 


 C
 C++
 Win32
 Direct3D
 OpenGL
 C#
 Java
 Free Tutorials