I have been testing my game to see how well it renders a few hundred complex models onscreen at once point but even when all the models are outside my viewpoint, i still get poor fps.

enter image description here

I have face culling enabled to get rid of back facing triangles, but I'm not sure how to stop processing triangles behind or outside my viewpoint.

  • 2
    \$\begingroup\$ The term you are looking for is "view frustum culling", there are many similar questions and tons of articles about its implementation. \$\endgroup\$
    – wondra
    Commented Dec 9, 2016 at 9:55
  • \$\begingroup\$ MonoGame comes with a Frustum implementation; all you have to do is pass in your matrices as a constructor, and then use their BoundingBox, etc to test for collisions. \$\endgroup\$
    – Krythic
    Commented Dec 9, 2016 at 18:25

1 Answer 1


As the comments under your question suggest, frustum culling is the way to improve performance.

To explain further:

The graphics hardware pipeline does not differentiate between what the camera can see and cannot. At the vertex shader stage, all that's happening is that a matrix transformation is applied to every vertex, and some other per-vertex work is done. Then (to simplify) rasterization takes place and then lighting & other work is carried out per fragment (or pixel).

In order to reduce the amount of work the gpu does, you must filter out what the camera cannot see, as to render those elements would be unnecessary work.

consider the following image:

enter image description here

This is a 2d representation of a frustum, with the red circle outside, and the green inside.

Think of a frustum in 3d as a trapezium. It has six faces, all of which have a face normal. For each face, project the cameras position, and the circle, or sphere's position onto the normal, and if the sphere's projection, += it's radius, is less than the camera projection, then on that side it can be deemed to be intersecting the frustum.

If this is true for all faces, then the sphere is at least partially inside the frustum, and is therefore visible, and so should be renderered. If this is not true for at least one face, then it is not visible and so should not be rendered.

It is relatively trivial to compute the frustum dimensions, and the maths can be found here.

To save on additional processing, you can have a flag in your camera, which marks it as "dirty" if it moves, which in turn, lets the rendering system know that the frustum needs updated for that frame.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .