<p>The typical prism/obb/aabb is made up of 6 planes, and the frustum is also typically made up of 6 planes.</p>
<p>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.</p>
<p>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.</p>
<p>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].</p>
<p>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.</p>
<p>And if you have specific questions I am happy to add more details to this answer.</p>

CC BY-SA 4.0
2021-05-13T18:45:16.600Z
And it also occurs to me that many folks call the function that does this "clipPolygon" searching should also help find code examples and explanations.
pmw1234
CC BY-SA 4.0
2021-05-13T11:14:04.520Z
2021-05-13T18:42:22.177Z
2021-05-13T18:42:22.177Z
pmw1234
<p>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.</p>
<p>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.</p>
<p>Any ideas?</p>

<voxelization>
Way to estimate the amount of overlap between a rectangular prism and a frustum?
Kaitlyn Emmons
# Way to estimate the amount of overlap between a rectangular prism and a frustum?

(Asked by: username_0 on 2021-05-13)

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?

**Tags:** voxelization


---

## 1 answers

### Answer by username_1 on 2021-05-13. Score: 1

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.

> **Comments:**
> **username_1**: And it also occurs to me that many folks call the function that does this "clipPolygon" searching should also help find code examples and explanations.  

---

