see

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?

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top