Skip to main content
gamedev.net
🔒 Locked

Octree problem...

Started by Daivuk May 21, 2003 at 3:45 PM 4 replies 1k views
Original Post
Daivuk
Daivuk
hi, I''m making a Octree for my engine. I load a map and build a octree with it. But I got I problem... When I create my face list for a Node, I have to choose all face that are in my Node. And who touch it. ? So, I can have a face that is in a Node and in another Node too. So, do I have to put this face in the two node''s list, but this will be a problem when drawing, because I will draw the same face two time. What should I do?? Splitting? hum. dont think so.
Dreamforger
Dreamforger
choose one point of the face, preferably the center an use this to determine where to put it.
When rendering, do not only render the stricly neccessary cubes but always ''some'' more. Having a maximum allowed object size helps you a lot at this point.
There is probably a better solution out there, but it''s getting quite late here, sorry

I may be getting older, but I refuse to grow up
Daivuk
Daivuk
hum, I will got problem with collision like this..
Eklipse
Eklipse
Just mark the poly as drawn with say the frame number. And check it before you render it. Or you can have a second list one for collison and one for rendering.
Daivuk
Daivuk
Good shot. I will make it like that.
Thanks a lot
ctoan
ctoan
A commonly used technique is to use quad/oct-trees for rendering polys, and to use a BSP tree (or another oct-tree, your choice) for collision detection. This way, you can optimize each tree to its needs. For example, you should almost NEVER perform collision tests against render-geometry (use a LOD!!) and you hardly EVER render collision-geometry (bounding-boxes, etc etc). Therefore, this two tree system is quite useful.

Another point is when you have a triangle in two (or more) nodes. When you have this case, you want to be sure to render the triangle if you see ANY of the nodes that it''s in, because you don''t want it to suddenly pop onto the screen when you move into it''s node (even though you could ''see'' it before). Therefore, the trick is to put the poly into ALL the nodes that it''s in, and simply have the is-rendered frame-counter, so you can tell if you already rendered the poly (like said above) Good luck!

Chris Pergrossi
< ctoan >
My Realm
Chris Pergrossi< ctoan >My Realm

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.