- Developer Blog
- Mailing Lists
- Getting Started
- Platform Specifics
- User Guides
- Programming Guides
- Reference Guides
- Tips And Tricks
- Knowledge Base
- Trac Usage Examples
- TracGuide Documentation
- Software Patents
- Software Patents Europe
It's a tree! Quite simply it is one the best and most reusable data structures invented. Typically drawn schematically with the root at the top, and leaves at the bottom. It all starts with a top-most root node which encompasses your whole virtual world, be it 2D or 3D. The world is then broken down into a hierarchy of nodes representing either spatial groupings of objects, settings of the position of objects, animations of objects, or definitions of logical relationships between objects such as those to manage the various states of a traffic light. The leaves of the graph represent the physical objects themselves, the drawable geometry and their material properties.
A scene graph isn't a complete game or simulation engine, although it may be one of the main components of such an engine; it's primary focus is representation of your 3d worlds, and efficient rendering thereof. Physics models, collision detection and audio are left to other development libraries that a user will integrate with. The fact that scene graphs don't typically integrate all these features is actually a really good thing: it aids interoprability with clients' own applications and tools and allows it to serve many varied markets from games, visual simulation, virtual reality, scientific and commercial visualization, training through to modeling programs.
Benefits that Scene Graphs provide
The key reasons that many graphics developers uses scene graphs are Performance, Productivity, Portability and Scalability:
- Performance Scene graphs provide an excellent framework for maximizing graphics performance. A good scene graph employs two key techniques - culling of the objects that won't be seen on screen, and state sorting of properties such as textures and materials, so that all similar objects are drawn together. Without culling the CPU, buses and GPU will all become swamped by many times the amount of data than they actually require to represent your scenes accurately. The hierarchical structure of the scene graph makes this culling process very efficient, for instance a whole city can be culled with just a few operations! Without state sorting, the buses and GPU will thrash between states, stalling the graphics pipeline and destroying graphics throughput. As GPU's get faster and faster, the cost of stalling the graphics pipeline is also going up, so scene graphs are becoming ever more important.
- Productivity Scene graphs take away much of the hard work required to develop high performance graphics applications. The scene graph manages all the graphics for you, reducing what would be thousands of lines of OpenGL down to a few simple calls. Furthermore, one of most powerful concepts in Object Oriented programming is that of object composition, enshrined in the Composite Design Pattern, which fits the scene graph tree structure perfectly and makes it a highly flexible and reusable design - in real terms this means that it can be easily adapted to solve your problems. Scene graphs also often come with additional utility libraries which range from helping users set up and manage graphics windows to importing of 3d models and images. All this together allows the user to achieve a great deal with very little coding. A dozen lines of code can be enough to load your data and create an interactive viewer!
- Portability Scene graphs encapsulate much of the lower level tasks of rendering graphics and reading and writing data, reducing or even eradicating the platform specific coding that you require in your own application. If the underlying scene graph is portable then moving from platform to platform can be as simple as recompiling your source code.
- Scalability Along with being able to dynamic manage the complexity of scenes automatically to account for differences in graphics performance across a range of machines, scene graphs also make it much easier to manage complex hardware configurations, such as clusters of graphics machines, or multiprocessor/multipipe systems such as SGI's Onyx. A good scene graph will allow the developer to concentrate on developing their own application while the rendering framework of the scene graph handles the different underlying hardware configurations.