Frustum Culling

Started by
4 comments, last by CableGuy 14 years, 8 months ago
Hi guys, im looking for some information regarding limiting triangles that are drawn within the viewing fustum. I am drawing a triangle grid (representing the ground) and in fullscreen mode (1440x900) my current frame count is around 800 with 1.x milliseconds per frame. I was wondering how i would go about implementing frustum culling?? Is there a specific algorithm(s)?? Apart from backface culling, which i am using, are there any other techniques?? i know about scene partitioning but i don't think i will need the use of these yet but if there are any resources on that topic then feel free to let me know. Thanks in advance, Danny
Advertisement
You don't want to be counting triangles during render time. What I would suggest is group your objects together as much as possible and do culling on each of the groups to eliminate them if they are out of view. If you are planning on rendering 1 million characters on the screen at the same time, then there isn't much you can do..... other then don't render 1 million characters!

Another common practice is to use lower levels of detail (LOD) when rendering objects further from the camera. There is no need to have high res models rendered really far away if in the rendered image they only show up as 100 pixels.
It is not clear to me if you want to implement frustum culling for rendering your triangle grid or for rendering all objects on the map or both.

For objects, just store all objects in some spatial data structure and cull against this structure. Possible structures are kd-tree (best suitable for static objects) or octree (useful for many dynamic objects). Then only render those objects that fall partially within the frustum.

If you want to apply culling to your triangle grid, its a little different, as the map is not easily partitioned in 'objects'. A simple solution is to divide your map in reasonable square sized cells and render all cells that overlap with the view frustum. There are more advanced methods, such as the LOD methods mentioned by mmakrzem.
Well i would like the triangles that are drawn on screen that are outside the viewing frustum to be culled. If they are static/dynamic objects or a simple triangle grid. Sorry i wasn't more clear.

A frustum culling technique that is non-discriminent on the type of object is what im looking for. If i have to adopt spacial partitioning that information on that would be great.

Thanks.
Chances are that checking if your tris are in the frustum are not for culling will be slower than just straight out rendering them all.

The only time something like this becomes useful if you have several tris grouped spatially. For example if you have a terrain broken down into a grid of several blocks, doing a check on each block could possibly help.
If it's just a 2d grid your best shot would be a quadtree. They are quite easy to implement. Also you don't cull triangles but group of triangles. Checking each triangle will just make performance worse. Also you will have to treat static/dynamic objects differently when doing frustum culling.

Hope this helps.

This topic is closed to new replies.

Advertisement