Hi,
I've done some reading before posting this, so I think that the answer
to my questions is not already in the forums. I've also searched the
internet and read some articles about octrees.
Bu I still have some doubts regarding this matter.
What happens if a object is too big, and is inside 2 or more octree
leafs Should the object be divided in 2 If not wouldn't the object be
drawn twice Or this should never happen If the object will get
divided the recursive function should exit and stop dividing
Thank you

Octrees question
Jitin Batra
Suppose the set of my game is a big field with moutains and plains. On the set, there will be smaller objects like trees, rocks, etc.
The root of the octree will be a cube with size=landscape size. If the main set isn't clipped, then I cannot sub-divide the root and all objects will be on the root.
Maybe I'm getting octrees wrong.
colin please
Depends on what algorithm you are using and what you want to do with it.
Some algoithms will leave big objects in the parent node rather than the leaf
Some algoithms will put the item in both leaf nodes and then use some kind of flag to prevent redrawing.
Splitting is an option but if you actually split the mesh you will probably never get the points to join back up perfectly.
SHL
Brad Wood
Sure you can. The main landscape just lives in the root node, the other bojects live at the lower nodes. The only difference is that objects can be attached at any nodes in the tree not just root nodes. Each node in your tree has 2 collections. GameObjects and ChildNodes. As you build you divide the current node into 8 if any object in that node will totally fit into a child node you put it in there. If it does not fit it stays in the parent. Then you recurse down to each child going as deep as you think you need.
Veera1
My octree is working!!
It's not perfect, but it is working. I'm dividing the octree until there is only one object on the leafs, or the leafs are smaller then x (in that case there might be more then one object inside it).
If an object is inside 2 diferent leafs, I put references on both leafs, but render the object only once.
I'm also sorting the objects from near to far and draw them in that order.
I haven't programmed games for some years now, butI was realy missing it!
Thanks for all the help
elsae
True. Except in certain very special textbook cases, there's probably no general way to avoid a visual artifact at the split planes.
Graham
iSreenivasRao.K
I understand what you mean, but this arises another question.
For simplicity I'll put the problem in 2D:
Suppose you have a small object that would fit in one child of the root. Now, suppose that the object lies in the intersection of the 4 childs.
Where should this object be put On the root On each child of the root, and then control the render routine not to render the object twice
Here, look at this image that ilustrates the problem.
www.geocities.com/lima_sma/img.jpg