FBX Scenes
 
 
 

Scene Graph Organization Summary

The FBX SDK scene graph is abstracted by the KFbxScene class. The scene is organized as a hierarchy of nodes (KFbxNode). The root node of the scene is accessed via KFbxScene::GetRootNode(). A scene element, for example, a mesh, a light, or a camera is defined by combining a KFbxNode with a subclass of KFbxNodeAttribute. For more information, see FBX Nodes and FBX Node Attributes.

NoteDuring an export operation, the root node of a scene is not exported to the file. Only the children of the root node are exported to the file. As such, it is not recommended to associate anything to the root node that should be saved to a file.

Creating a Scene

As illustrated in Managing Memory with the FBX SDK Manager, a KFbxScene is created by invoking the KFbxScene::Create() function. A new KFbxScene contains a root KFbxNode, and a KFbxGlobalSettings object with a default configuration.

// Create the SDK manager.
KFbxSdkManager* lSdkManager = KFbxSdkManager::Create();

// Create the scene.
KFbxScene* lScene = KFbxScene::Create(lSdkManager, "Scene Name");

Scene elements are created using a reference to the KFbxScene in which they belong. In doing so, the scene will be exported with all the elements which were created with it. In the following sample, a node is created with a reference to the KFbxScene, and attached to the root node of the scene.

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

// Create a child node.
KFbxNode* lChild = KFbxNode::Create(lScene, "child");

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

Global Scene Settings

The scene's axis system, system units, ambient lighting, and time settings are defined in its KFbxGlobalSettings object. This object is accessed via KFbxScene::GetGlobalSettings().

Animation Evaluation

The scene's KFbxAnimEvaluator evaluates the animated geometric transformations of each node in the scene at a specific time. It also evaluates any other animatable property of the scene, for example, the color change of a specific material. The scene's KFbxAnimEvaluator is accessed via KFbxScene::GetEvaluator(). For more information, see Animation.

Texture and Material Management

The materials (KFbxSurfaceMaterial) and textures (KFbxTexture) created within the scene can be accessed and modified using member functions such as KFbxScene::GetMaterial() and KFbxScene::GetTexture(). For more information on using materials and textures with meshes, see Meshes, Materials and Textures.

Characters and Character Pose Management

Characters (KFbxCharacter), and character poses (KFbxCharacterPose) within the scene can be accessed using KFbxScene::GetCharacter() and KFbxScene::GetCharacterPose(). Consult the class documentation of KFbxCharacter and KFbxCharacterPose for more information on how to define characters in a scene.

  • Merging Two Scenes

    This topic presents how to merge two imported scenes. It also provides basic insight on manipulating a scene and the nodes within it, and will initiate the reader to the concept of connections and connection management.

  • Scene Axis and Unit Conversion