Sign in to follow this  

TSM again...

This topic is 4861 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 again! Finally, I have computed the matrix N_T and tried to render the scene to screen to test if the matrix could be correct... as I alredy feared, I saw nothing. here are some of the values: (I used the D3D API, so matrices are transposed) scene camera: - near clipping plane = 5.0; - far clipping plane = 500.0; - FoV = pi/4; - viewpos = (0.0, 0.0, -40.0); - lookat = (0.0, 0.0, 1.0); so, the camera is looking into the scene. next, I used the following setup for the light (with an orthogonal projection) - lightcam_viewpos = (0, 500, 0); - lightcam_lookat = (0, -1, 0); as I already wrote, I used an orthogonal projection which is generated by D3DXMatrixOrthoLH: D3DXMatrixOrthoLH(mtLightProj, 3500.0, 3500.0, 50, 4000); so, if I render the scene using this projection and the lightcam, everything seems to be ok and I look down to the scene. Now, I tried to multiply the projection matrix with the computed N_T and use the result as projection transformation. I thought that I should see the scene now in lights post perspective space, but instead, I see nothing. So, I took a closer look to the N_T matrix and found a few strange values: | -383.47 0.0 0.0 0.0 | | 75.97 -164.39 0.0 157.32 | | 0.0 0.0 1.0 0.0 | | 21.02 -2.28 0.0 4.15 | nevertheless, I get the correct values when I transform the four verts of the trapezoid using this matrix. I work on this now for weeks and now, I don't have any idea whats wrong. maybe someone here who has successfully implmented TSM has some tips for me? thank you

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If N_T is correct, i.e. the four vertices of the trapezoid get mapped correctly, then you should be able to bring your scene into trapezoidal space. You have to set up your matrices such that your scene's vertices are transformed to trapezoidal space: N_T * P_L * C_L * W, where P_L is the light's projection matrix (orthogonal or projective), C_L the light's camera matrix and W the world matrix. In OpenGL I would do something like:

...
glMatrixMode(GL_MATRIX0_ARB);
glLoadMatrixf(N_T);

glMatrixMode(GL_PROJECTION);
glLoadMatrixf(P_L);
glMultMatrixf(C_L);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

renderScene();
...


Then you have to set up your vertex shader such that vertices are transformed to trapezoidal space (pseudo code):

vertexout = matrix0 * projection_matrix * modelview_matrix * world_matrix * vertexin;

Share this post


Link to post
Share on other sites

This topic is 4861 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.

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