Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Merging SceneGraph with BSP

This topic is 4812 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 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?

Share this post


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

Share this post


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

Share this post


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

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.

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!