The FBX SDK scene graph is abstracted by the FbxScene class. The scene is organized as a hierarchy of nodes (FbxNode). The root node of the scene is accessed via FbxScene::GetRootNode(). A scene element, for example, a mesh, a light, or a camera is defined by combining a FbxNode with a subclass of FbxNodeAttribute. For more information, see FBX Nodes and FBX Node Attributes.
As illustrated in Managing Memory with the FBX SDK Manager, a FbxScene is created by invoking the FbxScene::Create() function. A new FbxScene contains a root FbxNode, and a FbxGlobalSettings object with a default configuration.
// Create the SDK manager. FbxManager* lSdkManager = FbxManager::Create(); // Create the scene. FbxScene* lScene = FbxScene::Create(lSdkManager, "Scene Name");
Scene elements are created using a reference to the FbxScene 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 FbxScene, and attached to the root node of the scene.
// Get the root node of the scene. FbxNode* lRootNode = lScene->GetRootNode(); // Create a child node. FbxNode* lChild = FbxNode::Create(lScene, "child"); // Add the child to the root node. lRootNode->AddChild(lChild);
The scene's axis system, system units, ambient lighting, and time settings are defined in its FbxGlobalSettings object. This object is accessed via FbxScene::GetGlobalSettings().
The scene's FbxAnimEvaluator 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 FbxAnimEvaluator is accessed via FbxScene::GetEvaluator(). For more information, see Animation.
The materials (FbxSurfaceMaterial) and textures (FbxTexture) created within the scene can be accessed and modified using member functions such as FbxScene::GetMaterial() and FbxScene::GetTexture(). For more information on using materials and textures with meshes, see Meshes, Materials and Textures.
Characters (FbxCharacter), and character poses (FbxCharacterPose) within the scene can be accessed using FbxScene::GetCharacter() and FbxScene::GetCharacterPose(). Consult the class documentation of FbxCharacter and FbxCharacterPose for more information on how to define characters in a scene.
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.