# XNA Rendering vertices that only appear within the cameras view

I'm making a game in XNA and I recall hearing that professionally made games use a technique to only render the polygons that appear within the cameras projection. I've been trying to find something on this to do something similar in my game, could anyone point me in the right direction? Right now all I have is a plane/grid of vertices that you can set the X/Y on which is drawn using DrawUserIndexedPrimitives, but I plan to make a bunch of props as scenery items and I can imagine myself running into issues later on if I don't address this now.

Thanks

## Basic Frustum Culling

Frustum culling is what you are looking for and is very easy to do in XNA. Create a Bounding Frustum by passing in the view*projection matrices.

Frustum = new BoundingFrustum(view * projection);


Then create Bounding Boxes for your models. Finally you want to make sure you only draw the model's whose Bounding Boxes interact with the Bounding Frustum.

foreach (var gameobject in gameobjects) {
currentContainmentType = Frustum.Contains(BoundingBoxe);
if (currentContainmentType != ContainmentType.Disjoint)
{
//Draw gameobject
}
}

• Thanks, perfect. Up until now I didn't even know what it was called. :P – user1157885 Jun 25 '13 at 20:34
• Select as the answer please if you found it to be one. @user1157885 – ClassicThunder Jun 25 '13 at 20:36