Jump to content
  • Advertisement
Sign in to follow this  

Projection Matrix

This topic is 3513 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
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!