Jump to content
  • Advertisement
Sign in to follow this  
fazekaim

question about Trapezoidal Shadow Maps

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!