Iterate through Quad Tree to cull it

Started by
3 comments, last by Halsafar 18 years, 11 months ago
I already have a working frustrum culling quad-tree terrain based off a heightmap. It works fine, I just suddenly have a major concern in how I go through the nodes and cull. Curious if anyone would like to show me there method of iterating through there quad tree. So far I use a recursive functoin to go through it with a for..loop to 4. Each node has a sphere which is tested against the frustum planes; if the node is in the frustum then its branches are checked recursively. I believe I am doing it very "amature" way and would love to see a professional attempt. Btw, quad-tree's are pretty general so any function or explanation will do.
Advertisement
Sounds ok to me, however I would change the bounding sphere to an AABB. It might take a little longer to test but it will fit better. Also, (depending on how the terrain is rendered) you might want to draw an entire node, even if some of it would be culled.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Quote:Original post by Halsafar
if the node is in the frustum then its branches are checked recursively.

You need a bit more then a "in or out" check. Something like:
-Totaly outside -> stop recursion
-Patly inside/partly outside -> recursivly check children
-Totaly inside -> no need to check the children, just draw them and sava bunch of checks.

You might wat to also do a AABB check as JohnBolton sugested... You could first to a quick sphere test and if that failed do a AABB... it just might be worth it.
You should never let your fears become the boundaries of your dreams.
well if your tree is not of a fixed depth then recursive is the way to go (best way to go anyway).
Well good stuff to hear.

I guess I will direct my concerns elsewhere.

As for the AABB, I was thinking that myself since the sphere tests are not very accurate. I believe I may impliment a AABB once I get done with the engine. Rule of thumb for me: Optimization last, connect engine pieces first.

Although I believe AABB tests are more extensive than sphere tests ^^


Genjix,
Yes I can tell if it is intersecting, in, or out.

This topic is closed to new replies.

Advertisement