Merging SceneGraph with BSP

Started by
2 comments, last by Ingenu 18 years, 10 months ago
I read some post in this forum on mergin scenegraph and BSP tree. Someone said that to merge them after creating the BSP tree (e.g the map of the level), insert the scenegraph into the bsp tree. And have the leaf of the bsp store a pointer which reference to the scenegraph. Will there be any problems? If the mesh (scenegraph) span over a dividing plane of the BSP tree do you split the mesh(scenegraph)? Furthermore to render do I tranverse the BSP tree and then render the BSP first follow by the scenegraph? or render the scenegraph first?
Advertisement
You could merge both and insert SceneGraph Objects inside the BSPTree.
The BSPTree root node wouldn't be the SceneGraph ROOT Node, and the BSPNode insertion would be like that :

if SGObject Bounding Volume cross the BSPNode Plane
forget it it doesn't fit here or in children, return false;
else
if it's on the negative side, call NegativeChildNode.insert(...)
if it's on the positive side, call PositiveChildNode.insert(...)
if neither returned true, then THIS is the BSPNode where it must be inserted.


An alternative could be to multi reference a SceneGraph object in the leafs of the BSPTree, but I don't think you would gain anything from it.

Obviously with those methods, you'll call "render()" or "computeVisibility()" on the BSPTree, which will propagate it to its SceneGraph Objects.
(The Root BSPNode (start of the BSPTree), can just be a Child Node of the SceneGraph ROOT Node.)

-* So many things to do, so little time to spend. *-
Quote:Original post by Ingenu
(The Root BSPNode (start of the BSPTree), can just be a Child Node of the SceneGraph ROOT Node.)


I don't quite understand you here. What do you mean by the start of the BSP tree is just the child Node of a scene graph?

Yes.

ROOT
*-BSPNode (Root of BSPTree)
__*-Positive Side BSPNode
__*-Negative Side BSPNode
...


That basically means that the BSPNode class is inheriting from SceneGraphNode class, that way you can have anything in your SceneGraph.

You'll most likely use a SceneTree in fact, if you only have a single Parent per Node. You may want to have a Tree so you can have a BoundingVolume Hierarchy to speed up visibility test on Groups of objects. (A given Node BoundingVolume will be the merging of its Children, so that you can early discard the whole group.)

Insertion in such a SceneTree, is no issue, insert for the non spatial structure will simply be:
inline bool insert( SceneGraphNode* pSGNode ) { return false; }
while the function will have a 'real' implementation for spatial nodes. (BSPNode, Sector, OctreeNode, ...)
-* So many things to do, so little time to spend. *-

This topic is closed to new replies.

Advertisement