Sign in to follow this  
fazekaim

question about Trapezoidal Shadow Maps

Recommended Posts

Hello, i read the Trapezoidal Shadow Maps paper at http://www.comp.nus.edu.sg/~tants/tsm.html, and i think, i don't fully understand.
From the TSM site:
/ 1st path: TSM generation


	// as described in Section 6 in the TSM paper,
	// as a first step we have to calculate a trapezoid based on the
	// eye frustum E.
	// The four vertices are stored in t_0, t_1, t_2, t_3
	calculateTrapezoid(&t_0, &t_1, &t_2, &t_3, P_L, C_L, E);

	// ...after that N_T is calculated as described above
	calculateTrapezoidalTransformation(&N_T, t_0, t_1, t_2, t_3);

	glViewport(0, 0, shadowmapWidth, shadowmapHeight);

	// Bind the above vertex program...
	glBindProgramNV(GL_VERTEX_PROGRAM_NV, vpLight);

	// ...and bind the above fragment program
	glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, fpLight);

	glMatrixMode(GL_PROJECTION); // store N_T in GL_PROJECTION
	glLoadMatrixf(N_T);
	glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_PROJECTION, GL_IDENTITY_NV);

	glMatrixMode(GL_MATRIX1_NV); // store in P_L * C_L and track in GL_MATRIX1_NV
	glLoadMatrixf(P_L);          // light's projection matrix, e.g. achieved with gluPerspective()
	glMultMatrixf(C_L);          // light's camera matrix, e.g. achieved with gluLookAt()
	glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 8, GL_MATRIX1_NV, GL_IDENTITY_NV);

	glMatrixMode(GL_MODELVIEW);  // store the modelview matrix in GL_MODELVIEW
	glLoadIdentity();
	glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 12, GL_MODELVIEW, GL_IDENTITY_NV);

	renderScene();

	// Like in the standard shadow map approach we copy the depth buffer into a texture:
	CopyDepthBufferToTexture();
	...

	// 2nd path: render scene from eye's position and project TSM texture over the scene
	...
	SwapBuffers();

Why the code shouldn't call glu.gluLookAt( light.x, light.y, light.z, etc... ); and after rendering scene to texture calling glu.gluLookAt( eye.x, eye.y, eye.z, etc... ); ? How can I set the matrices if i'm using GLSL?, Has anyone experiences about TSM? Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this