문제

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