Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning OpenGL and I understand that OpenGL performs clipping as part of the pipeline, but is it a good idea to also perform manual clipping? By manual clipping, I mean not asking the GPU to draw an object if I'm certain it won't be visible on the screen.

The advantage I can think of is that the GPU will not be wasting time on executing the vertex shader only to find out the primitives are to be discarded. On the other hand, performing calculations on the CPU may cause the overall performance to decrease. I believe the world terrain model is loaded once and so it isn't a good idea to perform manual clipping for the terrain and reloading selective parts on the GPU's memory, but maybe doing this for things like trees boost performance.

Thank you!

share|improve this question
up vote 4 down vote accepted

Yes, this is a good idea in general, though it's usually called culling - not clipping.

There are two basic kinds of culling:

  1. Frustum culling tries to eliminate objects that aren't in the view frustum, i.e. are behind the camera or too far to the side to be visible on screen. This is commonly done by doing a conservative intersection test of an object's bounding box versus the frustum - for instance, testing if all eight corners of the box are outside the frustum on the same side. This is a fast and easy test that gets rid of the majority of the objects that aren't in the frustum.

  2. Occlusion culling tries to eliminate objects that are in the field of view, but not visible because they're hidden behind other objects. This is generally more difficult. There are various methods, and Google can tell you more.

As you say, culling per-vertex on the CPU is overkill since the GPU can do that more effectively. CPU culling is normally done at the per-object level, which allows you to remove the overhead of graphics state changes and draw calls for culled objects.

For large worlds with thousands of objects, it often pays off to have the objects arranged in a hierarchy such as a BVH or octree, which allows culling to be done at a higher level and eliminate many unwanted objects at a time.

Culling is a huge topic and this answer barely scratches the surface of it, but google around a bit and you'll find much more.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.