FBX SDK Programmer's Guide > Nodes and the Scene Graph >

# FBX Nodes

## What is a Node?

Nodes are primarily used to specify the position, rotation and scale of scene elements within a scene. Nodes are abstracted by the FbxNode class. A FbxScene contains a parent-child hierarchy of nodes. The root node of this tree is accessed via FbxScene::GetRootNode(). As detailed in FBX Scenes, additional nodes can be created and added to this root node.

    // Get the root node of the scene.
    FbxNode* lRootNode = lScene->GetRootNode();

    // Create a child node.
    FbxNode* lNode = FbxNode::Create(lScene, "child");

    // Add the child to the root node.
    lRootNode->AddChild(lNode);

NoteSome file formats do not allow for duplicate node names. In this case, the duplicate names will be renamed to: nodename_ncl1, nodename_ncl2, nodename_ncl3, etc. Note that previous FBX file formats (version 1.0 to version 6.1) did not allow for duplicate node names.

## Node Hierarchy

The node hierarchy is traversed using methods such as FbxNode::GetChild() and FbxNode::GetParent(). FbxNode::GetChildCount() returns the number of children of that node.

Nodes are organized in a hierarchy such that the position, rotation and scale of a node is described in relation to its parent's coordinate system. For example, in the diagram below, if the cubeNode is translated by 4 units along the rootNode's x-axis, the lightNode will also be affected by this translation. However, cameraNode will not be affected by this translation because cameraNode is not a child of cubeNode.

The order in which the rotation and scaling transforms are applied to a parent and its children is specified by the node's inherit type (ETransformInheritType). This transformation inheritance can be set using FbxNode::SetTransformationInheritType(). Consult the FbxNode class documentation for more details.

As mentioned in Exporting a Scene and FBX Scenes, the root node of the scene is not saved when the scene is exported. Only the recursively descendant children of the root node are exported with the scene. In the diagram above, assume rootNode is the root node of a scene. When the scene is exported, rootNode will not be saved. However, cubeNode, lightNode, and cameraNode will be saved to the file, along with their node attributes.

## Node Attributes

A mesh, a light, a camera, or any other object present in a scene is typically abstracted by a subclass of FbxNodeAttribute, for example FbxMesh, FbxLight or FbxCamera. A FbxNodeAttribute is bound to a FbxNode to describe its position in the scene. This binding is performed using FbxNode::SetNodeAttribute().

In the diagram above, the node attribute of FbxNode* lightNode is a FbxLight. The position of FbxLight* light in the scene will therefore depend on the cumulative transformations applied to each node from FbxNode* rootNode to FbxNode* lightNode.

More than one node attribute can be bound to a single node. This notion is useful when dealing with meshes of varying levels of detail (LOD). Similarly, one node attribute can be bound to multiple nodes. This technique is known as "instancing", and reduces memory consumption. For more information, see Instancing.

NoteA FbxSurfaceMaterial can also be bound to a node, and applied to its attributes to define, for example, the surface properties of a mesh. Observe that FbxSurfaceMaterial is not a subclass of FbxNodeAttribute.

## Transformation Data

The transformation data of a node includes its translation, rotation and scaling vectors with respect to its parent. This data is represented as a set of FbxTypedProperty objects, accessible via FbxNode::LclTranslation, FbxNode::LclRotation, FbxNode::LclScaling. Note that the "Lcl" prefix stands for "local".

    FbxDouble3 translation = lNode->LclTranslation.Get();
    FbxDouble3 rotation = lNode->LclRotation.Get();
    FbxDouble3 scaling = lNode->LclScaling.Get();

The transformation data of a node can be limited by a FbxLimits object, accessible via FbxNode::GetTranslationLimits(), FbxNode::GetRotationLimits(), and FbxNode::GetScalingLimits(). Nodes can also be constrained using FbxConstraint objects. Consult the class documentation of FbxLimits and FbxConstraint for more details.

The translation, rotation and scaling properties of a node with respect to the scene's global coordinate system can be expressed as a transformation matrix. This transformation matrix is obtained via FbxNode::EvaluateGlobalTransform().

## Grouping Nodes

Instances of FbxNode can exist without a bound FbxNodeAttribute. In this case, such a FbxNode can be used to group or position its children nodes in the scene.

#### Topics in this section

- Transformation Data
- Computing Transformation Matrices