Scene graph

from Wikipedia, the free encyclopedia

A scene graph is a data structure that is often used in the development of computer graphics applications. It is an object-oriented data structure with which the logical, in many cases also the spatial arrangement of the two- or three-dimensional scene to be displayed is described.

The term scene graph is only vaguely defined. This is due to the fact that concrete scene graphs are usually developed application-driven. The programmers use the basic idea, but adapt it to the specific requirements of the application. There are therefore no fixed rules as to which functions a scene graph must fulfill.

Hierarchical modeling

From the point of view of graph theory , a scene graph is a connected, directed graph without directed circles , the root node of which contains the entire scene (the “universe”). Subordinate to this root are child nodes that contain the individual objects of the scene or properties such as transformations and colors. These nodes can in turn be the root of a further tree, that is to say a further hierarchy of objects. Since it is a graph, not a tree, a node can have several parent nodes.

This approach enables hierarchical modeling of the objects in a scene. Each node of the scene graph usually has a transformation matrix . When this matrix is manipulated , the associated object itself, but also the objects of all subordinate nodes, are transformed . In this case, a distinction is made between object coordinates ( coordinates of an object with respect to the superordinate object) and world coordinates (coordinates of an object with respect to the origin of the universe - the root of the scene graph). This hierarchical view greatly simplifies the structure and manipulation of a scene. You do not have to transform each individual part of an object individually, but simply transform the entirety of all individual parts. If a scene contains many copies of an object, then all of these copies can be represented by one object. There are then several paths from the root to the node with this object. Each path with its own transformations and different properties. One speaks of instancing .

The modeling of a car with four wheels may serve as an example. A node in the scene graph represents the car object. This node has four child nodes, each of which contains the transformation matrices and rotation matrices of the individual wheels. These four child nodes in turn have one and the same child node that contains an object of the wheel type. One object - four representations. If the position or the location of the auto node is changed, the change also affects all child nodes, i.e. in this case the wheels. A manual recalculation of the position of the wheels is therefore not necessary.

Bounding Volume Hierarchies

Scene graphs are often used to render the scenes of an application more efficiently or to speed up calculations such as collision queries . For this purpose, a hierarchy of bounding volumes is carried along with a scene graph . Each node is also assigned a bounding volume that shows the spatial extent of the node including child nodes. Simple geometric bodies such as parallel-axis cuboids (AABBs), cuboids aligned on the object (OBBs) or spheres are used as bounding volumes.

With the help of the bounding volumes, all invisible elements (i.e. not in the view frustum ) are determined before the rendering process . If a node has already been classified as invisible, it is no longer necessary to check its child nodes. In this way, the amount of geometry that is potentially visible and therefore rendered can be reduced with little effort.

Well-known scene graph systems