• Advertisement
Sign in to follow this  

Debugging Frustum Culling

This topic is 4523 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have setup frustum culling with my engine but im not sure how I can debug it or even tell if its working or not .. im passing it thru my matrix's but im not sure how to tell.. anyone know of some ways I can tell if it is working.

Share this post


Link to post
Share on other sites
Advertisement
Do a count of triangles you are drawing total, a count of triangles you are passing to be drawn, and a count of triangles you are throwing away. Set up a simple scene (a couple cubes), rotate your camera around, and make sure the numbers all look right and everything is being rendered correctly.

Share this post


Link to post
Share on other sites
Instead of getting them from the camera, simply use frustum values that are fixed (or separately controlled). That way you can fly the camera around and see if the frustum culling is working. It might also help to draw the frustum.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
Instead of getting them from the camera, simply use frustum values that are fixed (or separately controlled). That way you can fly the camera around and see if the frustum culling is working. It might also help to draw the frustum.


An older SDK (probably 8.1-9.0a) had a nifty culling sample in it that did something like this. It had two viewports, each with a separate camera. You could fly around in the one viewport and see the culling results from the other viewport.

I'm not sure if you have it anymore (I have since removed it), but it would be a good help.

Share this post


Link to post
Share on other sites
What I did to test if my frustum culling was working was to draw the bounding box of the object I was trying to cull, and in the code write a message on the screen saying if the object was being culled or not. Then when running the app, as soon as the bounding box moved out of the camera's frustum, the message would come on the screen saying that it has been culled.

You don't have to write a message to the screen, you could simply change the colour of the background when the object is culled. You just need a way to tell if the culled code path happens. You can test this by putting a breakpoint in that will only be reached when the object is culled.


if(isThisObjectInTheCameraFrustum( objectToTest ))
{
render( objectToTest );
}
else
{
//The object was frustum culled
//Put your breakpoint here since you know the object has been culled
//As soon as the object goes off the screen, the code will stop and come to this breakpoint
}

Share this post


Link to post
Share on other sites
Quote:
Original post by SiliconMunky
What I did to test if my frustum culling was working was to draw the bounding box of the object I was trying to cull, and in the code write a message on the screen saying if the object was being culled or not. Then when running the app, as soon as the bounding box moved out of the camera's frustum, the message would come on the screen saying that it has been culled.

You don't have to write a message to the screen, you could simply change the colour of the background when the object is culled. You just need a way to tell if the culled code path happens. You can test this by putting a breakpoint in that will only be reached when the object is culled.


if(isThisObjectInTheCameraFrustum( objectToTest ))
{
render( objectToTest );
}
else
{
//The object was frustum culled
//Put your breakpoint here since you know the object has been culled
//As soon as the object goes off the screen, the code will stop and come to this breakpoint
}


Great IDEA! I will def. try this out and see what happends

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement