3D model essentials

3D models are imported into Argon verse in glTF format. There are a number of supported features that these models can include.

See Set entity position for information on how you can configure a 3D model in an Argons Verse scene to set its position, scale, etc.

Keep in mind that all models, their shaders, and their textures must be within the parameters of the characters limitations.

Below are the maximum number of elements allowed in a scene:

n represents the number of parcels that a scene occupies.

  • Triangles: n x 10000 Total amount of triangles for all the models in the scene.

  • Entities: n x 200 Amount of entities in the scene.

  • Bodies: n x 300 Amount of meshes in the scene.

  • Materials: log2(n+1) x 20 Amount of materials in the scene. It includes materials imported as part of models.

  • Textures: log2(n+1) x 10 Amount of textures in the scene. It includes textures imported as part of models.

  • Height: log2(n+1) x 20 Height in meters.

    Note: Only entities that are currently being rendered in the scene are counted for these limits. If your scene switches between 3D models, what matters is the rendered models at any point in time, not the total sum. Player avatars and any items brought by a player from outside the scene don’t count for calculating these limits either.

  • File size: 15 MB per parcel Total size of the files uploaded to the content server. Includes 3D models and audio. Doesn’t include files that aren’t uploaded, such as node.js packages.

  • File count: 200 files per parcel Total count of the files uploaded. Includes 3D models and audio. Doesn’t include files that aren’t uploaded, such as node.js packages.

Texture size constraints

Texture sizes must use width and height numbers (in pixels) that match the following numbers:

1, 2, 4, 8, 16, 32, 64, 128, 256, 512

This sequence is made up of powers of two: f(x) = 2 ^ x . 512 is the maximum number we allow for a texture size. This is a fairly common requirement among other rendering engines, it’s there due internal optimizations of the graphics processors.

The width and height don’t need to have the same number, but they both need to belong to this sequence.

The recommended size for textures is 512x512, we have found this to be the optimal size to be transported through domestic networks and to provide reasonable loading/quality experiences.

Examples of other valid sizes:

32x32
64x32
512x256
512x512

Note: Although textures of arbitrary sizes sometimes work, they are also often rendered with bugs and are more unstable. We strongly advise that all your textures match these sizes.

Supported 3D model formats

All 3D models in Argons Verse must be in glTF format. glTF (GL Transmission Format) is an open project by Khronos providing a common, extensible format for 3D assets that is both efficient and highly interoperable with modern web technologies.

glTF models can have either a .gltf or a .glb extension. glTF files are human-readable, you can open one in a text editor and read it like a JSON file. This is useful, for example, to verify that animations are properly attached and to check for their names. glb files are binary, so they’re not readable but they are considerably smaller in size, which is good for the scene’s performance.

We recommend using .gltf while you’re working on a scene, but then switching to .glb when uploading it.

The following aspects of a 3D model can either be embedded in a glTF file or referenced externally:

  • Textures can either be embedded or referenced from an external image file.

  • Binary data about geometry, animations, and other buffer-related aspects of the model can either be embedded or referenced from an external .bin file.

Note: Animations must be embedded inside the glTF file

Export to glTF from Blender

When exporting 3D models that include multiple animations, make sure that all animations are embedded in the model. To do this, open the NLA editor and click Stash to add each animation to the model.

We recommend using the following export settings when exporting models with animations:

Blender export menu

Export to glTF from 3D Studio Max

3D Studio Max doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

  1. Download the plugin from this link.

  2. Install the plugin by following these instructions.

  3. Export glTF files using the plugin by following these instructions.

Export to glTF from Maya

Maya doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

  1. Install the plugin by following these instructions.

  2. Export glTF files using the plugin by following these instructions.

Note: As an alternative, you can try this other plugin too.

Export to glTF from Unity

Unity doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

Download the plugin from this link.

Note: As an alternative, you can try this other plugin too.

Export to glTF from SketchUp

SketchUp doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

Download the plugin from this link.

Preview a glTF model

A quick and easy way to preview the contents of a glTF model before importing it into a scene is to use the Babylon.js Sandbox. Just drag and drop the glTF file (and its .bin file if applicable) into the canvas to view the model.

In the sandbox you can also view the animations that are embedded in the model, select which to display by picking it out of a dropdown menu.

This is a command line tool for converting 3D model assets on Autodesk's venerable FBX format to glTF 2.0, a modern runtime asset delivery format.

Precompiled binaries releases for Windows, Mac OS X and Linux may be found here.

Bleeding-edge binaries for Windows may be found here. Linux and Mac OS X to come; meanwhile, you can build your own

FBX features

  • Single-step interoperability

    Work between Autodesk 3D animation software tools.

  • More efficient workflow

    Integrate toolsets and transfer data between applications.

  • Easier data exchange

    Simplify digital asset exchange with other creative teams.

Running

The tool can be invoked like so:

 > FBX2glTF ~/models/butterfly.fbx

Or perhaps, as part of a more complex pipeline:

 > FBX2glTF --binary --draco --verbose \
          --input ~/models/source/butterfly.fbx \
          --output ~/models/target/butterfly.glb

There are also some friendly & hands-on instructions available over at Facebook.

CLI Switches

You can always run the binary with --help to see what options it takes:

FBX2glTF 0.9.7: Generate a glTF 2.0 representation of an FBX model.
Usage: FBX2glTF [OPTIONS] [FBX Model]

Positionals:
  FBX Model FILE              The FBX model to convert.

Options:
  -h,--help                   Print this help message and exit
  -v,--verbose                Include blend shape tangents, if reported present by the FBX SDK.
  -V,--version
  -i,--input FILE             The FBX model to convert.
  -o,--output TEXT            Where to generate the output, without suffix.
  -e,--embed                  Inline buffers as data:// URIs within generated non-binary glTF.
  -b,--binary                 Output a single binary format .glb file.
  --long-indices (never|auto|always)
                              Whether to use 32-bit indices.
  --compute-normals (never|broken|missing|always)
                              When to compute vertex normals from mesh geometry.
  --anim-framerate (bake24|bake30|bake60)
                              Select baked animation framerate.
  --flip-u                    Flip all U texture coordinates.
  --no-flip-u                 Don't flip U texture coordinates.
  --flip-v                    Flip all V texture coordinates.
  --no-flip-v                 Don't flip V texture coordinates.
  --no-khr-lights-punctual    Don't use KHR_lights_punctual extension to export FBX lights.
  --user-properties           Transcribe FBX User Properties into glTF node and material 'extras'.
  --blend-shape-normals       Include blend shape normals, if reported present by the FBX SDK.
  --blend-shape-tangents      Include blend shape tangents, if reported present by the FBX SDK.
  -k,--keep-attribute (position|normal|tangent|binormial|color|uv0|uv1|auto) ...
                              Used repeatedly to build a limiting set of vertex attributes to keep.
  --fbx-temp-dir DIR          Temporary directory to be used by FBX SDK.


Materials:
  --pbr-metallic-roughness    Try to glean glTF 2.0 native PBR attributes from the FBX.
  --khr-materials-unlit       Use KHR_materials_unlit extension to request an unlit shader.


Draco:
  -d,--draco                  Apply Draco mesh compression to geometries.
  --draco-compression-level INT in [0 - 10]=7
                              The compression level to tune Draco to.
  --draco-bits-for-position INT in [1 - 32]=14
                              How many bits to quantize position to.
  --draco-bits-for-uv INT in [1 - 32]=10
                              How many bits to quantize UV coordinates to.
  --draco-bits-for-normals INT in [1 - 32]=10
                              How many bits to quantize nornals to.
  --draco-bits-for-colors INT in [1 - 32]=8
                              How many bits to quantize colors to.
  --draco-bits-for-other INT in [1 - 32]=8
                              How many bits to quantize all other vertex attributes to.

Some of these switches are not obvious:

  • --embed is the way to get a single distributable file without using the binary format. It encodes the binary buffer(s) as a single base64-encoded data:// URI. This is a very slow and space-consuming way to accomplish what the binary format was invented to do simply and efficiently, but it can be useful e.g. for loaders that don't understand the .glb format.

  • --flip-u and --flip-v, when enabled, will apply a x -> (1.0 - x) function to all u or v texture coordinates respectively. The u version is perhaps not commonly used, but flipping v is the default behaviour. Your FBX is likely constructed with the assumption that (0, 0) is bottom left, whereas glTF has (0, 0) as top left. To produce spec-compliant glTF, we must flip the texcoords. To request unflipped coordinates:

  • --long-indices lets you force the use of either 16-bit or 32-bit indices. The default option is auto, which make the choice on a per-mesh-size basis.

  • --compute-normals controls when automatic vertex normals should be computed from the mesh. By default, empty normals (which are forbidden by glTF) are replaced. A choice of 'missing' implies 'broken', but additionally creates normals for models that lack them completely.

  • --no-flip-v will actively disable v coordinat flipping. This can be useful if your textures are pre-flipped, or if for some other reason you were already in a glTF-centric texture coordinate system.

  • All three material options are, in their own way, works in progress, but the --pbr-metallic-roughness switch is at least compliant with the core spec; unlike the others, it does not depend on an unratified extension. That option will be chosen by default if you supply none of the others. Material switches are documented further below.

  • If you supply any -keep-attribute option, you enable a mode wherein you must supply it repeatedly to list all the vertex attributes you wish to keep in the conversion process. This is a way to trim the size of the resulting glTF if you know the FBX contains superfluous attributes. The supported arguments are position, normal, tangent, color, uv0, and uv1.

  • When blend shapes are present, you may use --blend-shape-normals and --blend-shape-tangents to include normal and tangent attributes in the glTF morph targets. They are not included by default because they rarely or never seem to be correctly present in the actual FBX source, which means the SDK must be computing them from geometry, unasked? In any case, they are beyond the control of the artist, and can yield strange crinkly behaviour. Since they also take up significant space in the output file, we made them opt-in.

Building it on your own

We currently depend on the open source projects Draco, MathFu, Json, cppcodec, CLI11, stb, and fmt; all of which are automatically downloaded and/or built.

At present, only version 2019.2 of the FBX SDK is supported. The build system will not successfully locate any other version.

Linux and MacOS X

Your development environment will need to have:

  • build essentials (gcc for Linux, clang for Mac)

  • cmake

  • python 3.* and associated pip3/pip command

  • zstd

Then, compilation on Unix machines will look something like:

# Determine SDK location & build settings for Linux vs (Recent) Mac OS X
> if [[ "$OSTYPE" == "darwin"* ]]; then
    export CONAN_CONFIG="-s compiler=apple-clang -s compiler.version=10.0 -s compiler.libcxx=libc++"
    export FBXSDK_TARBALL="https://github.com/zellski/FBXSDK-Darwin/archive/2019.2.tar.gz"
elif [[ "$OSTYPE" == "linux"* ]]; then
    export CONAN_CONFIG="-s compiler.libcxx=libstdc++11"
    export FBXSDK_TARBALL="https://github.com/zellski/FBXSDK-Linux/archive/2019.2.tar.gz"
else
    echo "This snippet only handles Mac OS X and Linux."
fi

# Fetch Project
> git clone https://github.com/facebookincubator/FBX2glTF.git
> cd FBX2glTF

# Fetch and unpack FBX SDK
> curl -sL "${FBXSDK_TARBALL}" | tar xz --strip-components=1 --include */sdk/
# Then decompress the contents
> zstd -d -r --rm sdk

# Install and configure Conan, if needed
> pip3 install conan # or sometimes just "pip"; you may need to install Python/PIP
> conan remote add --force bincrafters https://api.bintray.com/conan/bincrafters/public-conan

# Initialize & run build
> conan install . -i build -s build_type=Release ${CONAN_CONFIG}
> conan build . -bf build

If all goes well, you will end up with a statically linked executable in ./build/FBX2glTF.

Windows

the below is out of date

Windows users may download CMake for Windows, install it and run it on the FBX2glTF checkout (choose a build directory distinct from the source).

As part of this process, you will be asked to choose which generator to use. At present, only Visual Studio 2017 or 2019 is supported. Older versions of the IDE are unlikely to successfully build the tool.

Note that the CMAKE_BUILD_TYPE variable from the Unix Makefile system is entirely ignored here; it is when you open the generated solution that you will be choose one of the canonical build types — Debug, Release, MinSizeRel, and so on.

Conversion Process

The actual translation begins with the FBX SDK parsing the input file, and ends with the generation of the descriptive JSON that forms the core of glTF, along with binary buffers that hold geometry and animations (and optionally also emedded resources such as textures.)

In the process, each mesh is ripped apart into a long list of triangles and their associated vertices, with a material assigned to each one. A similar process happens in reverse when we construct meshes and materials that conform to the expectations of the glTF format.

Exporting as Unlit

If you have a model was constructed using an unlit workflow, e.g. a photogrammetry capture or a landscape with careful baked-in lighting, you may choose to export it using the --khr-materials-common switch. This incurs a dependency on the glTF extension 'KHR_materials_unlit; a client that accepts that extension is making a promise it'll do its best to render pixel values without lighting calculations.

Note that at the time of writing, this glTF extension is still undergoing the ratification process

Exporting as Metallic-Roughness PBR

Given the command line flag --pbr-metallic-roughness, we throw ourselves into the warm embrace of glTF 2.0's PBR preference.

As mentioned above, there is little consensus in the world on how PBR should be represented in FBX. At present, we support only one format: Stingray PBS. This is a feature that comes bundled with Maya, and any PBR model exported through that route should be digested propertly by FBX2glTF.

(A happy note: Allegorithmic's Substance Painter also exports Stingray PBS, when hooked up to Maya.)

Draco Compression

The tool will optionally apply Draco compression to the geometric data of each mesh (vertex indices, positions, normals, per-vertex color, and so on). This can be dramatically effective in reducing the size of the output file, especially for static models.

Enabling this feature adds an expressed required dependency in the glTF on the KHR_draco_geometry_compression extension, and can thus only be loaded by a viewer that is willing and able to decompress the data.

Note that at the time of writing, this glTF extension is still undergoing the ratification process.

3D models are imported into Argons verse in glTF format. There are a number of supported features that these models can include. This section goes over ways to make them compatible with argons verse and best practices.

Supported 3D model formats

All 3D models in Argons Verse must be in glTF format. glTF (GL Transmission Format) is an open project by Khronos providing a common, extensible format for 3D assets that is both efficient and highly interoperable with modern web technologies.

glTF models can have either a .gltf or a .glb extension. glTF files are human-readable, you can open one in a text editor and read it like a JSON file. This is useful, for example, to verify that animations are properly attached and to check for their names. glb files are binary, so they’re not readable but they are considerably smaller in size, which is good for the scene’s performance.

We recommend using .gltf while you’re working on a scene, but then switching to .glb when uploading it.

The following aspects of a 3D model can either be embedded in a glTF file or referenced externally:

  • Textures can either be embedded or referenced from an external image file.

  • Binary data about geometry, animations, and other buffer-related aspects of the model can either be embedded or referenced from an external .bin file.

Note: Animations must be embedded inside the glTF file to use in Argons Verse.

Export to glTF from Blender

When exporting 3D models that include multiple animations, make sure that all animations are embedded in the model. To do this, open the NLA editor and click Stash to add each animation to the model.

We recommend using the following export settings when exporting models with animations:

Blender export menu

Export to glTF from 3D Studio Max

3D Studio Max doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

  1. Download the plugin from this link.

  2. Install the plugin by following these instructions.

  3. Export glTF files using the plugin by following these instructions.

Export to glTF from Maya

Maya doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

  1. Install the plugin by following these instructions.

  2. Export glTF files using the plugin by following these instructions.

Note: As an alternative, you can try this other plugin too.

Export to glTF from Unity

Unity doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

Download the plugin from this link.

Note: As an alternative, you can try this other plugin too.

Export to glTF from SketchUp

SketchUp doesn’t support exporting to glTF by default, but you can install a plugin to enable it.

Download the plugin from this link.

Preview a glTF model

A quick and easy way to preview the contents of a glTF model before importing it into a scene is to use the Babylon.js Sandbox. Just drag and drop the glTF file (and its .bin file if applicable) into the canvas to view the model.

In the sandbox you can also view the animations that are embedded in the model, select which to display by picking it out of a dropdown menu.

Why we use glTF

Compared to the older OBJ format, which supports only vertices, normals, texture coordinates, and basic materials, glTF provides a more powerful set of features that includes:

  • Hierarchical objects

  • Skeletal structure and animation

  • More robust materials and shaders

  • Scene information (light sources, cameras)

Compared to COLLADA, the supported features are very similar. However, because glTF focuses on providing a “transmission format” rather than an editor format, it is more interoperable with web technologies.

Consider this analogy: the .PSD (Adobe Photoshop) format is helpful for editing 2D images, but images must then be converted to .JPG for use on the web. In the same way, COLLADA may be used to edit a 3D asset, but glTF is a simpler way of transmitting it while rendering the same result.

Convert fbx into glTF

.fbx is a very popular standard for 3D models. It’s not supported by our engine, but you can easily export an .fbx model to .gltf format.

We recommend using these tools:

  • Facebook’s CLI tool: this is the most robust alternative, but requires using the command line.

  • Blackthread: This the most complete web based tool. Less robust than the CLI, but a lot easier to use.

  • Modelconverter: Another easy-to-use web based tool.

Optimize a glTF

The following tool offers some optimizations that will make 3D models lighter and faster to download for players in your scene.

glTF pipeline

Among other things, it converts .gltf format into .glb, which is binary and so occupies a lot less. It also places texture files outside the 3D model, which allows you to use the same texture on multiple models.

Note: .glb format by default always has textures embedded in the file. The engine can’t recognize two embedded textures as the same, they need to be external files that share a same hash.

Last updated