Scenegraph Hierarchy Rules |
The Shockwave 3D§ scenegraph comprises nodes that transform and group hierarchies of objects within a scene. There are four basic nodes:
group nodes, which specify location within the world space and reference data
light nodes, which specify the light parameters
model nodes, which specify mesh geometry, mesh modifiers, bones, keyframes, and materials
view nodes, which specify camera data
Keep in mind that it may be far easier to create detailed animations and scenes with a familiar authoring tool, and then export the scene, than to try to create them after an export. In other words, use the tool you know best and that provides the greatest control of the scene elements to produce the most desirable effect.
Knowing how an authoring tool works and how its scenegraph is converted into the Shockwave 3D scenegraph will allow you to create an exporter that will export every authored nuance as accurately as possible.
One goal of the export process is to eliminate all redundancy. When writing an exporter to create a scene in Shockwave 3D, be sure that only one copy of everything (including shared meshes and materials) goes into the Shockwave 3D scene database.
Another goal of the export process is to simplify or reduce the overall number of nodes in the Shockwave 3D scenegraph wherever possible. This is done by collapsing multiple meshes and bones down to a single model resource. Reducing the number of scenegraph model nodes that Shockwave 3D must track, render, and run collision and picking tests against, allows the scenegraph to run at real-time speed.
Some aspects of collapsing a scenegraph are required, and others are optional. For example, bones and the meshes they deform must be collapsed into a single model resource. Likewise, if a collection of meshes will always exist as a single unit and never need to be animated separately should be collapsed. If the meshes will be animated individually, however, they should not be collapsed and should be exported, each to their own model resource. Even though an exporter that always collapses groups of meshes can be forced to export them individuallythrough the creative use of an authoring tool's grouping mechanismit may need to have a switch that lets users turn off the collapsing mechanism. If this is the case, be sure to point out the performance trade off to users.
Here are some suggested rules for converting the scenegraph from an authoring tool into a Shockwave 3D scenegraph, and some suggestions for how to collapse the scenegraph:
All root-level children nodes remain children of the root node.
(The only exception is with group or model nodes with model geometry or bones as children. See rule 4.)
-->
Example 1: The mesh1, mesh2, and the light node, all children of the root node, remain the same in the Shockwave 3D scenegraph.
A group node at whatever level with no immediate children remains a group node.
-->
Example 2: A group node with no children remains a group node.
A group node at any level with children that are not model bones or geometry remains a group node with these children.
-->
Example 3: A group node with light node children remains a group node with light node children.
A group node that has children that are model bones or geometry is collapsed into a single Shockwave 3D model scene node containing all associated resources and data from the children bones or geometry. The parent of the collapsed group node becomes the parent node of the single aggregated model node.
or
or
-->
Example 4: A single mesh child of a group node, mesh siblings of a group node, or two mesh siblings and the child mesh of one of the siblings all collapse into a single mesh node in the Shockwave 3D scenegraph. The parent of the group node, the root node, becomes the parent of the single mesh node.
The aggregation of a group node's model bones and geometry nodes stops when a non-bone or non-geometry child node is detected. That non-bone or non-geometry node becomes a child node of the aggregate model node.
-->
Example 5: The light node, originally a child of the model mesh node under the group node, becomes a child of aggregate model node.
If a non-bone or non-geometry node child is a sibling of a bone or geometry node of a group node, it becomes a child node of the aggregate parent.
-->
Example 6: Sibling model nodes and their parent group node collapse into a single model node. The light node sibling becomes a child sibling along with the aggregate model nodes of the aggregate parent.
Light and camera nodes with children act as group nodes in the Shockwave 3D scenegraph. Any bones or geometry that are children of these nodes will collapse into a single model node, just as they do under a group node.
-->
Example 7: The model nodes collapse into a single model node. The light 'group' node, however remains a 'group' node and is not aggregated with the model nodes to its parent as a true group node does.
Each asset that acts as a scenegraph node (model mesh, group, light, camera) must have a unique name.
§See asterisked (*) statement at Legal Information © 2001 Intel Corporation.