# TSM again...

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

## 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 on other sites
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);

glMatrixMode(GL_PROJECTION);
glMultMatrixf(C_L);

glMatrixMode(GL_MODELVIEW);

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;

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633288
• Total Posts
3011222
• ### Who's Online (See full list)

There are no registered users currently online

×