Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


octree questions

This topic is 5244 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 read about the tutorial about octree in the gametutorials site. He load there a large object and make the octree on this. I try to think about a way to use this octree if I have alot of objects - and I''m wonder if it''s the correct way : for each devision : 1) make a loop throgth all the objects in the scene and throgth all of their vertex. 2) if a vertex should be in a certain box - I make a pointer from this box to the appropriate model (if this box not alradey contain a pointer to the model). problems that I can think of are: 1) there could be a situation that the same model will be in many boxes(if one vertexes can place in diffrent boxes) - so if I want to draw it I''ll ask if I haven''t draw it before. 2) it''s not so efficient in my opinion - moving thorough all the vertex in the scene (sometimes even more - if the models doubled like in - 1) each time I want to divide the secene to smaller boxes. if there is more efficient way to use it I''ll appreciate it if you could tell me about it.

Share this post

Link to post
Share on other sites
The problems you're describing are actually pretty simple:

1) if a model (an object) is in several nodes (what you call boxes), you'll most likely want to either decide which node the object belongs to based on its origin (one central point) or some surrounding shape (a surrounding collision sphere, for instance) that will either decide which node the object belongs to or will place the object in several nodes. You'll want to do this if you're using the octree for collision detection or visibility checking. Just remember to keep a flag attached to the object to see if you've already tested that object.

2) The point is that you don't move anything: you simply rearrange pointer lists, which is not inefficient at all if you compare it to the speedup it will experience through the use of quadtrees or octrees.

Hope that explained it a little.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!