Sign in to follow this  

frustum culling question

This topic is 3845 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

im implementing frustum culling, and i had an idea about an optimization. is it a good idea to just test 4 planes versus all 6? im thinking of skipping the near and far planes. ideally i want an infinite draw distance (kinda like quake wars).

Share this post


Link to post
Share on other sites
Well, I do see your reasoning behind not testing the near or the far. However, I personally test all six, usually testing the near plane first. What I would do if I were you would be to create a sample scene and see if you get any framerate improvements.

My engine does a plane-sphere test before going to a plane-OBB test, so I doubt that in my engine I would see much of an improvement although now that you've mentioned this I'm going to give it a try.

Share this post


Link to post
Share on other sites
Well, anything behind the near plane is not visible at all, regardless of infinite viewing distance. If you don't test it, you'll be rendering a bunch of stuff behind the camera that is never in view. On the other hand, I can see your idea for the far plane, but then if you are using any kind of space partition, like a quad tree, then the tests for nodes past the far plane should be fairly quick (very large chunks of terrain eliminated at once), compared to the cost of rendering a lot of things that would normally have been culled.

If you look across an open field in real life you will notice that A) you have "infinite" viewing distance and that B) the "infinite" distance seems rather short with respect to the size of the planet because of the general shape of the land. If you are implementing any sort of distance fog, dust or other distortion in your application, or if your terrain has a sensible amount of topology then you should be able to find an actual far distance plane that gives the impression of infinite viewing distance, when in reality, it's 10,000 units away.

But, like the previous poster said, give it a test in your engine and see if you get any performance benefits from it. Though, if you are using quadtree, octree or something similar then you'll probably see more fps while using the far and near plane tests than without them.

Webby

Share this post


Link to post
Share on other sites
the idea of keeping the far plane due to the curve of the earth or fogging long distances doesnt seem feasible. im not going to have huge areas (that i know of). checking the near plane, ive figured, is a waste of time because of you are testing the left, right, top and bottom planes, the planes are going to continue behind the camera too. therefore anything behind the camera will not be drawn.

Share this post


Link to post
Share on other sites
I took a slightly different approach - I store the index of the frustum plane which last rejected a mesh and test that one first next time for each mesh. In many cases, I only perform a single plane test, as camera movement is mostly coherent. The overhead is only 4 bytes per mesh (could easily be 1 byte) and yields a nice speedup.

Share this post


Link to post
Share on other sites

This topic is 3845 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this