Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

SceneGraph Implementation

Started by vicer1234 Nov 27, 2009 at 5:28 AM 6 replies 8.4k views
Original Post
vicer1234
vicer1234
Hi, I am trying to implement scene graph using c++ and OpenGl. My purpose is to learn the basic working of it while implementing. My understanding is that its like a tree structure which has nodes and it helps in controlling the objects in world, so that its easy to add and delete objects ( Let me know if its right ). So first i tried to implement two classes one for SceneNode and other for SceneGraph. SceneGraph controls the root node and SceneNode takes care of creating nodes and its different functionality like deleting, updating etc. Next i am trying to implement some math classes like matrix,quaternion,vector. It is also somewhat done. Now what i want to know is what should be the next thing i should try for in order to complete it and also is this approach good enough. All suggestions are welcome.
mmakrzem
mmakrzem
Have a look in the Game Development section on my website. I show in detail how to create a scenegraph system in the video tutorials.
Kwizatz
Kwizatz
Scene Graphs seem like a good idea, but they're not, you can do the same thing a scene graph does, simpler and more efficiently with a container for all your world objects (of course, space partitioned preferably), check out Scene Graphs, Just say No
vicer1234
vicer1234
Quote:
Original post by Kwizatz
Scene Graphs seem like a good idea, but they're not, you can do the same thing a scene graph does, simpler and more efficiently with a container for all your world objects (of course, space partitioned preferably), check out Scene Graphs, Just say No


I want to continue with scene graph, because I want to understand its working properly. After that I can try out other ways of implementation.
krum
krum
Quote:
Original post by Kwizatz
Scene Graphs seem like a good idea, but they're not,


I completely disagree with much of Tom Forsyth's arguments against scene graphs. Scene graphs solves all sorts of problems that can not be easily implemented any other way. I wouldn't use them to solve every problem that can be solved with them (like scene culling), they should be an integral part of any general purpose game engine.

If the game engine that I have to use at work had a scene graph, my life would be much easier.
Black Knight
Black Knight
I never bothered implementing a SceneGraph too.I just have a 2 vectors of pointers to entities and that's it.One of them stores all the entities on the world and the other one stores the visible entities.

vector > entities;
vector > visibleEntities;

Then in my update world method I just fill the visibleEntities by frustum culling and the renderer just draws the visibleEntities vector to scene.Pretty simple but works :)


Kwizatz
Kwizatz
Quote:
Original post by krum
Quote:
Original post by Kwizatz
Scene Graphs seem like a good idea, but they're not,


I completely disagree with much of Tom Forsyth's arguments against scene graphs. Scene graphs solves all sorts of problems that can not be easily implemented any other way. I wouldn't use them to solve every problem that can be solved with them (like scene culling), they should be an integral part of any general purpose game engine.

If the game engine that I have to use at work had a scene graph, my life would be much easier.


I agree with him because I was seeing all the problems he mentions in my design, a root node with a bazillion children, hacks to get up and down the hierarchy, I use a different system for skeletal animation, so it wasn't like "gun" was a child of "hand" or even "character", I even had a separate array of pointers to the nodes to do collision tests.

In the end, the only use I saw it was serving was for pushing and popping model view matrices for rendering and since all my objects were at level 1 of the tree, I wasn't gaining anything.

Still I just had to use a Scene Graph because that's what all the cool kids use, so I found his post liberating, of course, if you do have good reasons to use one, by all means do so, from my experience, they just add complexity though.
vicer1234
vicer1234
Hi,
I want to know if there is any good scene graph tutorial which any one can
recommend that shows its proper working and implementation.

Topic Locked

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

Sign in to reply to this topic.