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.
During 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.
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.