Sign in to follow this  

Projection Matrix

This topic is 3155 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

I am trying to extract the values used to create a projection matrix. I found the following MSDN page and derived my math from there. Everything comes out correctly, except the far plane. The far plane is very close, but has an error of around .07 . I assume that is due to floating point error? although only one calculation has been done on the matrix. Is there a more accurate way to get that value? I also, don't understand how to get the Fov from the matrix.
   // Disassemble the projection matrix
   float q         = origProjection._33;
   float nearPlane = origProjection._43 / -q;
   float farPlane  = -q * nearPlane / (1.0f - q);
   float width     = 2.0f * nearPlane / origProjection._11;
   float height    = 2.0f * nearPlane / origProjection._22;
   float ratio     = width / height;



Original values near 0.1 far 1000 ratio 1.25 Obtained values near 0.1 far 999.93408 ratio 1.25

Share this post


Link to post
Share on other sites

This topic is 3155 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