Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


calculating view frustrum from view, proj matrices

This topic is 5495 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 know this is a pretty basic question, but it''s been a while since linear algebra for me... If I know my View and Projection matrices, how can I calculate the 4 (disregarding near/far clip planes) plane equations describing the view frustrum? First I have to compose the two together, then I''m guessing that have to take pairs of vectors out of the composed matrix and use them to generate the plane normal via cross product...is this correct? What details am I missing? How do you get those vectors out of the View/Proj composition? thanks

Share this post

Link to post
Share on other sites
the equation of the projection matrix is

p=|cot(FOVw/2) 0 0 0|
|0 cot(FOVh/2) 0 0|
|0 0 f/(f-n) 0|
|0 0 0 -fn/(f-n)|

n: near plane distance
f: far plane distance
fovw: horizontal field of view in radians
fovh: vertical field of view in radians

so if you have the projection matrix then the element (3,3) equals f/(f-n) and the element (4,4) equals -f/(f-n) .then you can solve as two equations in two unknowns to find f and n.then the equation of the near plane in the camera coordinates is z=n, and the equation of the far plane in the camera coordinates is z=p.
the equation of the right plane is z-x/(tan FOVh)=0
the equation of the left plane is z+x/(tan FOVh)=0
all difined in the camera coordinates i.e the eye is the origin,the right vector is the positive x direction,the up vector is the positive y direction. you can use matrices to change them to other coordinate systems you want.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!