Scene Graph
Table of contents
When we render a scene with 64 bunnies as shown below, we can choose to store all the 64 bunnies, or store one bunny and then transform it 64 times.
A scene graph is a tree structure that represents the objects in a scene and their relationships. It is a hierarchical data structure that contains all the objects in a scene. It is a way to organize the objects in a scene. This allow us to edit one object (lets say the wheel of the example below) and have the changes propagate to all the other wheels.
Ray Tracing
How do we ray trace this scene graph? There are two options:
- Place all transformed objects in 3D world
- Traverse the scene graph and apply transformations to each geometric object
Lets take a look at placing all transformed objects in the 3D world first:
Before ray tracing is started:
- Traverse scene graph, apply transformations to each geometric object
- Place all transformed objects in 3D world
During ray tracing:
- Trace rays in fully instanced 3D world and intersect rays with transformed objects
Properties:
- Entire world in memory
- Difficult to intersect or represent some types of object (e.g. transformed torus)
- Easier to build acceleration structures
Lets now take a look at applying inverse transformations to the rays:
During ray tracing:
- Traverse the scene graph for each ray, applying inverse transformations to the ray
- Intersect inverse-transformed rays with original, non-transformed objects
- Transform the intersection points (and normal vectors)
Properties:
- No need to store entire world in memory
- Easy to intersect most objects (e.g. transformed torus)
- More diffucult to build acceleration structures
In practice, we use a combination of the two. We use the first method to build acceleration structures and the second method to intersect rays with objects.