Way to estimate the amount of overlap between a rectangular prism and a frustum? I am looking for some way to estimate the amount of overlap between a rectangular prism(not axis aligned) and a frustum. The rectangular prism is probably always going to be larger than the frustum itself. Basically if the prism overlaps the frustum completely the overlap function should output 1, and if the prism is completely outside the frustum it should output 0. And hopefully if it partially overlaps it outputs a value between 0-1 that is the amount of overlap. It doesn't need to be a perfect estimate I think, but it should get close and should be correct for cases where its completely overlapping or completely separate.
This will be used to voxelize the prism into a view frustum aligned 3D texture, where each entry in the 3D texture is a small frustum itself.
Any ideas?
The typical prism/obb/aabb is made up of 6 planes, and the frustum is also typically made up of 6 planes.
To generate a new volume that is the intersection of the two original volumes, use plane clipping to clip one against the other. This technique is generic enough that it can be used with any object like a mesh.
That is take all the planes from the frustum then clip them one by one against the prism. After each clip operation, the new volume becomes the input to the next clipping operation.
What is left will be the clipped volume representing the intersection of the two. Compute the volume of the new shape and divide it by the original volume and you will get a value that is somewhere between [0,1].
This technique is often used to generate decals in games (though the volume computation is not done). Searching the web for decal generation alogorithms/tutorials should help you with the implementation details.
And if you have specific questions I am happy to add more details to this answer.