Posted in Examples on October 28th, 2008 by sHTiF
Sorry i couldn’t come up with more appropriate title for this post, i chose advanced based on that its a quite improved version from the previous one.
Ok i will go straight to the problem that comes up with most frustum culling implementations, that its just a separate checking of multiple planes. Let me explain more, lets say you have 5 planes (skipping the far plane) defining a camera frustum and you need to check each face against them. Most engines, for example my latest demo on frustum culling or the latest Papervision3D frustum culling demo, check em one at a time and generate splits accordingly so if 1st plane splits the face and generate 2 new faces that are visible, you take those 2 faces and check em with the 2nd plane which may result in 4 faces for example so you took em and check em with the 3rd face… you get the point. This proves really inefficient when face is going to be clipped with 2 and more frustum planes, so if you are really close to some face you may end up with something like this:

So i’ve asked myself is there something we can do about this?
Yes we can indeed, i’ve come up with another method (i am sure someone already came with it before i didnt really check) where i try to avoid splitting into faces at all. Instead i am generating temporary polygon. Ok let me put some light in it, lets start as we always do we have a face that needs to be checked for visibility and we also have the 5 planes that define the frustum. We take the face and split it against the 1st plane, but here comes the diference, instead of generating multiple faces we will just generate a polygon so instead of 2 faces like in previous scenario we would end up with a quad, next step is to check this polygon against the 2nd plane and again generate a polygon which will be inside, then the 3rd plane… again you get the point. But there is a final step that needs to be done, after we went through all the planes we need to get triangles again, easy we will use triangle fan algorithm to triangulate the polygon since its always convex. This way we will generate always the best triangulation possible for the splitted parts. So lets go near the face really close like in the first scenario and tadaaa this is what we get

Demo where you can switch between these methods at runtime: DEMO
Tags: Agile3D