# Culling Techniques for 3d OpenGL ES game

I'm developing a 3d flight simulator for Android and am using a relatively large (10k triangles) scene in 3ds format for the scenery. The scene is one polygon soup, not separated into separate objects. Frustum culling per triangle would be time consuming. What techniques could I use to render the triangles that are only visible in the view-port?

Per-triangle culling is done by the GPU, so you should only draw entire objects. Some tips:

• Break down your scene into smaller objects, preferably doing it based on their material, so they are drawn in a single batch.
• Calculate a bounding box for each object, and intersect them with the view frustum. Discard or draw them based on this criteria.
• Use VBOs for your data, uploading it once to the GPU and then drawing them directly from VRAM.
• If you have a very large object, like a ground plane, consider implementing a quadtree approach (or octree if it isn't flat).
• Consider using level of detail (LOD) for detailed, distant objects.

You should separate the triangles in groups, as in making separate game objects, then assign a bounding volume to it and check the box geometry against the frustum planes to discard all triangles contained in the bounding volume.

You need to separate objects in order to define a local coordinate space/object center for each triangle group that makes a 3D object. You can't skip groups of triangles if the only information you have are just the vertex position of random triangles, so you need to define a local center for groups or triangles and these triangles' vertices be described relative to the local object center. Then for transforming the vertices' positions to the global coordinates, just add the object's center to each vertex to translate to the global coordinates (but this won't work for rotations, you should build a matrix instead if you want both a rotation and translation transform).

So either you make a file for each object, or parse the single file and separate them on loading, but the later is difficult and you will work better if geometries are already split and have a local origin defined.

• BSP and Octrees are common ways to split up the geometry of a scene into groups for the technique described here. Feb 18 '12 at 14:26
• I agree, but I believe he can't apply a BSP/Octree in a triangle soup, he first need to split the geometry into separate objects and/or spatial nodes. The triangle soup would count as a single node in the tree, which wouldn't really help, I mean how to know which triangle belongs to which tree node without testing every one? Unless he attach a node index to each triangle or use a VBO to encompass groups of tris. Even with the index approach, he would have to test each triangle to assign the index, while building and testing a VBO is much easier/faster. I use a combination of both techniques. Mar 4 '12 at 6:29

Octrees are a good way to organize polygon soup scenes for visibility culling. The idea is similar to other sorts of recursive dividing techniques like BSP or even quicksort, but more 3 dimensional.