Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

Iterate through Quad Tree to cull it

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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
well if your tree is not of a fixed depth then recursive is the way to go (best way to go anyway).

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!