# AABB frustum culling

This topic is 4672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there a better way of doing a AABB frustum culling rather than looping though each frustum plane, and then looping per bounding vertex? It seems there should be a better way than running through a loop 48 times per box per frame ( not to mention using D3DXPlaneDotCoord() - that can't be that fast of a function ) Is there a better way?

##### Share on other sites
Yes, there is a better way.

To know if a box is intersecting or completely behind a plane, you only need to look at one vertex. That vertex is the one with the minimum signed distance to the plane (or maximum depending on which direction your planes are facing). For a given plane, the vertex to look at is the same for all AABBs (for example, it might be the vertex in the positive x and y and negative z directions, relative to the box's center, or whatever).

##### Share on other sites
Can you explain it a little bit better? It sounds like you are turning the bounding box into a bounding sphere and testing that ( I already am doing that )

##### Share on other sites
No, it's not turning it into a sphere.

For purposes of this discussion let's say the frustum planes are oriented so the positive side is outside the frustum. For a single point, you can calculate the signed distance to a plane. If the distance between a point and a frustum plane is positive, it is outside the frustum. If for all planes the distance is negative, the point is inside the frustum.

For any shape, to know that the shape is entirely outside the frustum plane we only need to check the point on the shape that has the minimum signed distance from the plane. Since all the other points of the shape are an equal or greater distance from the plane, if the signed distance of the minimum distance point is positive, all the other points are also positive, and the shape is outside the frustum.

The only point that needs to be tested is the extreme point in the opposite direction as the plane's normal. For axis aligned bounding boxes, this will be a particular corner determined by the signs of the components of the plane's normal. If the AABB has center (Cx,Cy,Cz) and extents of (Ex, Ey, Ez), and the plane's normal is (.58, -.58, .58), the vertex with the minimal signed distance to the plane is (Cx - Ex, Cy + Ey, Cx - Ez). This is the only vertex that needs to be checked to know if the box is entirely outside the frustum.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×