Reputation: 67
When bounding box's all 8 vertex is out side the frustum, it won't be rendered. But if sth happened like shown above. That object should be in the display list. Any idea?
Upvotes: 3
Views: 2826
Reputation: 8651
Compute the bounding sphere from your bbox and check the center distance from each one of the 6 frustum planes. If one of them is less than the sphere radius include your object in the display list.
Upvotes: 0
Reputation: 22376
Because you are calculating the intersection as if the box is bunch of points, instead of a bunch of lines. This is how I do it in pseudo-code:
inter = Inside
for ( plane : frustum ) {
verts[2] = findOpposingPointsMostPerpendicularToPlane( box, plane )
near = plane.signedDistance( verts[0] ) > 0.0
far = plane.signedDistance( verts[1] ) > 0.0
if ( !near && !far )
inter = Outside
break
else ( near ^ far )
inter = Intersecting
}
If your box is an AABB, you create a static array of vertex indices for findOpposingPointsMostPerpendicularToPlane()
and then map to them using the sign of the plane normal components.
Upvotes: 3