Jump to content
  • Advertisement
Sign in to follow this  
widggman

plane problem!!

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

Hi, Here's what I want to do. I create bounding box that are at various level in a quad tree. I want to extract the the planes of the frustum and test if a bounding box is inside the frustum or not. Currently, I don't care about the near and far plane. So, if a bounding box is inside the frustum, I continue to explore the quad tree. And so on until I reached a leaf and I draw what is necessary. My problem is to extract the for basic planes. I took a look at some web pages, and they use the matrix on top of the ModelView multiplied by the matrix on top of the Projection. Then, apparently, the left plane is [m14+m11, m24+m21, m34+m31, m44+m41]. I made some test with that, even by using clipping plane instead, and to help me, if a bounding box is not accepted, I draw the bounding box instead of the contain. But the problem is that I can see some bounding box that I shouldn't see. To create the plane, I extract the normal and I take the closest point to the origin. Then, I use this to test the distance of every corner of the bounding box, if one of them is on the right side of the plane, I consider the bounding box to be inside. But the problem is that I can see some rejected bounding box. I also made some test with clipping planes but these looks like they work fine. So, what am I doing wrong ?

Share this post


Link to post
Share on other sites
Advertisement
I didn't quite follow all of that, but here are a few quick comments:
Quote:
My problem is to extract the for basic planes. I took a look at some web pages, and they use the matrix on top of the ModelView multiplied by the matrix on top of the Projection. Then, apparently, the left plane is [m14+m11, m24+m21, m34+m31, m44+m41].
When using that method, make sure that you have all of your various conventions right (row vs. column vectors, D3D vs. OpenGL z clip range, etc.). If you get any of these details wrong, the extracted planes may be incorrect.
Quote:
To create the plane, I extract the normal and I take the closest point to the origin.
That doesn't sound right. The plane equations returned by the aforementioned algorithm should give you all the info you need to perform your culling tests (from what you've described, it sounds like you're doing some extra work above and beyond that).
Quote:
Then, I use this to test the distance of every corner of the bounding box, if one of them is on the right side of the plane, I consider the bounding box to be inside.
There are more efficient ways of performing the test than testing each corner individually. However, the test you've describe should work (that is, if all eight corners of the box are behind the plane, the box is behind the plane).
Quote:
But the problem is that I can see some rejected bounding box. I also made some test with clipping planes but these looks like they work fine. So, what am I doing wrong ?
I don't know if this is what you're seeing, but keep in mind that your typical box-frustum test is conservative; that is, it may occasionally consider a box to be intersecting the frustum when it is not (typically, these boxes will be oriented such that they do not fall fully behind any one plane, but do not actually intersect the frustum volume).

Share this post


Link to post
Share on other sites
Look at this tutorial to extract the planes:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=44

Use the second optimized version..you can optimize more by throwing away the planes you do not need.

After this you do checks against the frustum planes.

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!