#### Archived

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.

## 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 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)|

Variables:
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.

many thanks

1. 1
2. 2
Rutin
22
3. 3
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002297
×