PDA

View Full Version : Shadow volume capping



jeppa
01-29-2002, 12:28 AM
I had read the document "Robust stencil Shadow Volmues",and I have setting the depthrange and projection matrix how read it.
But my shadow volume does not visualized.

My metod:
//********DRAW SCENE************
glDepthRange(0.1f,1.0f);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(ProjectiveMatrix);
glMatrixMode(GL_MODELVIEW);
RenderScene();

//************DRAW SHADOW VOLUMES**********
glDepthRange(0.0,1.0f);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(ProjectiveMatrixShadow);
glMatrixMode(GL_MODELVIEW);
RenderShadowVolumes();


this is my metod for setting the projection matrix used for shadow volumes:

f=0.1f // depth range f
n=1.0f; // depth range n
F=100.0F; // FAR PLANE
N=0.1F; // NEAR PLANE
n'=0.05f;

Ns=-(f-n)*F*N;
Ns/=(n*N-f*F-n'*(F-N));
gluPerspective(45.0f,RATIO,Ns,F)


and projection matrix used to render the scene.

gluPerspective(45.0f,RATIO,N,F)

--------------------------------------------

Thanks in Advance

Sandro