Building a Scene Graph
A Java 3D virtual universe is created from a scene graph. A scene graph is created using instances of Java 3D classes. The scene graph is assembled from objects to define the geometry, sound, lights, location, orientation, and appearance of visual and audio objects. See slideshow.

A Java 3D scene graphs is constructed of Node objects in parent-child
relationships forming a tree structure. In a tree structure, one node
is the root. Other nodes are accessible following arcs from the root.
The arcs of a tree form no cycles. A scene graph is formed from the
trees rooted at the Locale objects. The NodeComponents and reference
arcs are not part of the scene graph tree. Only one path exists from
the root of a tree to each of the leaves; therefore, there is only one
path from the root of a scene graph to each leaf node. The path from
the root of a scene graph to a specific leaf node is the leaf
nodes scene graph path. Since a scene graph path leads to exactly
one leaf, there is one scene graph path for each leaf in the scene
graph.
Each scene graph path in a Java 3D scene graph completely specifies the state information of its leaf. State information includes the location, orientation, and size of a visual object. Consequently, the visual attributes of each visual object depend only on its scene graph path. The Java 3D renderer takes advantage of this fact and renders the leaves in the order it determines to be most efficient. The Java 3D programmer normally does not have control over the rendering order of objects.
Each scene graph has a single VirtualUniverse. The VirtualUniverse object has a list of Locale objects. A Locale object provides a reference point in the virtual universe. Think of a Locale object as being a landmark used to determine the location of visual objects in the virtual universe. It is technically possible for a Java 3D program to have more than one VirtualUniverse object, thus defining more than one virtual universe. However, there is no inherent way to communicate among virtual universes. Further, a scene graph object can not exist in multiple virtual universes simultaneously. It is highly recommended to use one and only one instance of VirtualUniverse in each Java 3D program. While a VirtualUniverse object may reference many Locale objects, most Java 3D programs have only one Locale object. Each Locale object may serve as the root of multiple subgraphs of the scene graph.
A BranchGroup object is the root of a subgraph, or branch graph. There are two different categories of scene subgraph: the view branch graph and the content branch graph. The content branch graph specifies the contents of the virtual universe - geometry, appearance, behavior, location, sound, and lights. The view branch graph specifies the viewing parameters such as the viewing location and direction. Together, the two branches specify much of the work the renderer has to do.
Scene Graph Hierarchy
The VirtualUniverse, Locale, Group, and Leaf classes appear in this portion of the hierarchy. Other than the VirtualUniverse and Locale objects, the rest of a scene graph is composed of SceneGraphObject objects. SceneGraphObject is the superclass for nearly every Core and Utility Java 3D class. SceneGraphObject has two subclasses: Node and NodeComponent. The subclasses of Node provide most of the objects in the scene graph. A Node object is either a Group node or a Leaf node object. Group and Leaf are superclasses to a number of subclasses. Here is a quick look at the Node class, its two subclasses, and the NodeComponent class. After this background material is covered, the construction of Java 3D programs is explained.
Node Class
The Node class is an abstract superclass of Group and Leaf classes.
The Node class defines some important common methods for its
subclasses. Information on specific methods is presented in later
sections after more background material is covered. The subclasses of
Node compose scene graphs.
Group Class
The Group class is the superclass used in specifying the location and
orientation of visual objects in the virtual universe. Two of the
subclasses of Group are BranchGroup and TransformGroup. In the
graphical representation of the scene graph, the Group symbols
(circles) are often annotated with BG for BranchGroups, TG for
TransformGroups, etc.
Leaf Class
The Leaf class is the superclass used in specifying the shape, sound,
and behavior of visual objects in the virtual universe. Some of the
subclasses of Leaf are Shape3D, Light, Behavior, and Sound. These
objects can have no children but may reference NodeComponents.