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.

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 on other sites
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 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.

1. 1
2. 2
3. 3
Rutin
12
4. 4
5. 5

• 26
• 10
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633694
• Total Posts
3013378
×