What are scene graphs?
A scene graph is a graphical scene data that forms a hierarchy made up of nodes and edges. Scene graphs specifies the relationships between objects in a game. Its like a tree that contains parent nodes and child nodes. Take a look at this scene graph below.Lets say for example you have a dining table set with chairs around. The parent node would of course be the dining set and the chairs would be children of the dining set. This is the same idea with scene graphs for games. If we were doing a scene graph about gameplay then we would make gameplay the root node. That root node would then become a parent of all the other components that help make up gameplay. Examples could be like physics, characters, enemies, etc. Scene graphs allows us to organize objects, organize primitives, group transformation, and group effects such as shaders.
Scene graphs provide a great framework for a team to organize their work. In games, scene graphs help programmers be able to organize the overall structure of the game. It really causes one the think about all the necessary components before actually starting the implementation. Sometimes when a group of gamers get together and gather up all of these great ideas and yet still were not able to get it done because of lack of data. You cannot have one thing before the other. That is why scene graphs are important to have. They are like the core of game engines. They feed geometry to the renderer. They should also gather information based on spacial proximity and render-state coherency.
Scene graphs provide 4 key benefits:
- Performance
- Productivity
- Portability
- Scalability.
It is a great framework to build on for any 3D game. It encourages game developers to be more aware of the components being used in the game engine.
Conclusion
Scene graphs are beneficial and very useful for any 3D game. It sure helped us at the beginning of our studio game development. We had a very lengthy scene graph that I thought was very over whelming but it was great to see how we were constantly referring back to it as we continued developing our game.