Jump to content
  • Advertisement
Sign in to follow this  
Daishim

OpenGL Frustum Determination

This topic is 4325 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've been reading the article "Frustum Culling In OpenGL", and I'm wondering exactly how it works. The article states to multiply the modelview matrix and the projection matrix. Then finds the difference/sum of certain positions in the matrix. Can anyone help shed some light on, or point me in the right direction, as to why/how this works? I'm fairly solid with matrices and vectors, I'm just a little confused as to how we get the frustum planes from all of that. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The modelview-projection matrix takes points from world-space to screen-space, as I'm sure you know. The viewing frustum, is the preimage of the screen (a cube) under this transformation. The near and far clipping-planes are the preimages of the screen rectangle at z = 1, z = 0; the other four planes correspond to the edges of the screen.

If you look at the equations of the planes of this cube (in screen-space), you'll see that they have a lot of zeros (when compared to the general equation of a plane), primarily because they are axis-aligned. This means that when put them through the inverse modelview-projection matrix, only a few of the matrix entries come into play. If you felt compelled to do so, you could write down the primaries of these planes, invert a general mvp matrix and apply the transformation. You'd find that the resulting vectors come out exactly as the well-documented frustum formulas say they should.

There is nothing magical about this. An average intellect could not look at a compound projection matrix and say 'just add these matrix elements together to get frustum plane A, ...'. Originally, the algebra was done manually, and the results recorded and distributed so nobody else had to waste their time doing the donkey-work. Obviously in retrospect, looking at the resulting formulas, certain relations make perfect sense. Others are not so obvious.

I'd advise you to just take this as read. If you're still not happy, I guess there isn't much else you can do but to derive the formulas yourself.

Regards
Admiral

Share this post


Link to post
Share on other sites
Quote:
Original post by Daishim
I've been reading the article "Frustum Culling In OpenGL", and I'm wondering exactly how it works. The article states to multiply the modelview matrix and the projection matrix. Then finds the difference/sum of certain positions in the matrix. Can anyone help shed some light on, or point me in the right direction, as to why/how this works? I'm fairly solid with matrices and vectors, I'm just a little confused as to how we get the frustum planes from all of that.

Thanks.
If you're interested in the derivation, I suggest you google for a paper called "Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix", by Gribb and Hartmann. It's available online, and gives a fairly clear explanation of how the algorithm is derived.

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.

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!