Sign in to follow this  
zurekx

What happens when multiplying by projection matrix

Recommended Posts

When a vertex i multiplied with the projectin matrix (and, of course, the model view matrix), what kind of points do I have? Are the points in the unit cube or what? Im talking about just multiplying with the projection matrix, not dividing with the w-coordinate or anything. Because Im trying to render a scene, where I set the color to the z-coordinate after multiplying with this matrix, and I get some strange results, the value doesnt seem to be in the range [-1, 1].

Share this post


Link to post
Share on other sites
if a Vertex is multiplied with the gl_(ModelView)ProjectionMatrix it is in a 4 dimensional unnamed space. After the dividing the XY and Z component by W the vertex is in postperspective space (range [-1.0.... 1.0] for XYZ if the vertex is located inside the frustum) This division (and the transformation into screenspace) is still part of the fixed pipline.

If you have calculate the vertex screen position in your program add that division after the matrixmultiplication.

Share this post


Link to post
Share on other sites
Thanks.. I just want to color the screen with the depth (im visualising a shadow map). Then, perhaps, I should just take the eyespace z-coordinate and divide by the depth of the far-plane? After I divide by w, isnt z allways 1?

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