Skip to content

FBX file format

Romain Milbert edited this page May 12, 2024 · 11 revisions

FBX meshes can be imported using Raz::FbxFormat::load(), which returns both a Mesh and a MeshRenderer, from RaZ/Data/FbxFormat.hpp.

#include <RaZ/Data/FbxFormat.hpp>

auto [mesh, meshRenderer] = Raz::FbxFormat::load("path/to/mesh.fbx");

// Adding the Mesh component is purely optional, unless you want to manipulate its data
// If you want to render the mesh, the MeshRenderer is however needed
entity.addComponent<Raz::Mesh>(std::move(mesh));
entity.addComponent<Raz::MeshRenderer>(std::move(meshRenderer));

FBX SDK

RaZ supports FBX importation using the FBX SDK. At the time of writing, the latest available version is the 2020.0.1: https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0

Windows

  • Download the SDK from https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/2020-0-1/fbx202001_fbxsdk_vs2017_win.exe (or any available MSVC version), and install it.
  • It will be assumed to be installed at the default place in C:\Program Files\Autodesk\FBX\FBX SDK\<version> (<version> being for example 2020.0.1 if downloaded from the link right above; having it installed in Program Files (x86) will work, though it is not supposed to be in there).
  • When building RaZ, just check the box to use FBX or call CMake with -DRAZ_USE_FBX=ON; if not installed in one of the assumed places, define manually the path to your SDK root directory.

Linux

  • Download the SDK from http://download.autodesk.com/us/fbx/2019/2019.0/fbx20190_fbxsdk_linux.tar.gz.
    • NB: The SDK 2020.0.1 is available under Linux as well, but unsupported by RaZ for now.
  • It is recommended to install it into /usr or /usr/local, though the building stage will also seek it under /home/<username>/*FBX* (lowercase fbx as well).
    • Recommended commands for doing so:
    • $ cd /tmp
    • $ wget http://download.autodesk.com/us/fbx/2019/2019.0/fbx20190_fbxsdk_linux.tar.gz
    • $ tar xvf fbx20190_fbxsdk_linux.tar.gz
    • $ sudo ./fbx20190_fbxsdk_linux /usr/local
      • The parameter, here /usr/local, will indicate where to install it.
  • When building RaZ, just check the box to use FBX or call CMake with -DRAZ_USE_FBX=ON; if not installed in one of the assumed places, define manually the path to your SDK root directory.
Clone this wiki locally