glTF vs FBX
Two file formats carry most 3D assets into game engines. FBX is Autodesk's proprietary format, the long-time industry default for Unity and Unreal. glTF 2.0 is an open Khronos standard, sometimes called "the JPEG of 3D", designed to be loaded by real-time engines with little conversion. Knowing what each one stores, and being able to look inside a glTF file, saves hours of "why does it look different in the engine?".
Side by side
| glTF 2.0 | FBX | |
|---|---|---|
| Owner, spec | Khronos Group, open specification | Autodesk, proprietary (SDK under Autodesk's licence) |
| File types | .gltf (JSON) + .bin + images, or one binary .glb |
binary or ASCII .fbx |
| Units and axes | fixed by the spec: metres, +Y up, front faces +Z | stored in the file; varies by exporter |
| Materials | PBR metallic-roughness built in, plus extensions | legacy material models; PBR mapping varies by tool |
| Animation | skins, morph targets, keyframes | skins, blend shapes, keyframes, more DCC-specific data |
| Engines | Godot (preferred), three.js/Babylon.js, Unity (glTFast package), Unreal (glTF Importer plugin) | Unity and Unreal (native), Godot (via the FBX2glTF tool or the built-in ufbx importer in Godot 4.3+) |
| Extensions | Draco and meshopt compression, KTX2/Basis textures, lights, variants | – |
Rules of thumb: Godot and web → glTF (.glb). Unity and Unreal → FBX is still the most battle-tested route, especially for animated characters, but glTF works well for static props. Whichever you pick, keep the .blend (or .ma, .max) source in version control next to the export, because both formats lose editing information.
What is inside a glTF
A glTF file is JSON that points into binary buffers:
scene → nodes (transform tree) → mesh → primitives → attributes (POSITION, NORMAL, TEXCOORD_0…)
↓
accessors (type, count, min/max) → bufferViews → buffers (bytes)Because it's JSON, you can inspect and validate it with a few lines of Python. The example below embeds a tiny glTF (one triangle) with its buffer as a base64 data URI, then reports what an engine would see, including a transform problem:
import base64, json, struct
GLTF = r'''{
"asset": {"version": "2.0", "generator": "hand-written example"},
"scene": 0,
"scenes": [{"name": "Scene", "nodes": [0]}],
"nodes": [{"name": "Crate", "mesh": 0, "scale": [100, 100, 100]}],
"meshes": [{"name": "CrateMesh", "primitives": [{"attributes": {"POSITION": 0}, "indices": 1, "material": 0}]}],
"materials": [{"name": "M_Crate", "pbrMetallicRoughness": {"baseColorFactor": [0.8, 0.5, 0.2, 1], "metallicFactor": 0, "roughnessFactor": 0.7}}],
"accessors": [
{"bufferView": 0, "componentType": 5126, "count": 3, "type": "VEC3", "min": [0, 0, 0], "max": [1, 1, 0]},
{"bufferView": 1, "componentType": 5123, "count": 3, "type": "SCALAR"}
],
"bufferViews": [
{"buffer": 0, "byteOffset": 0, "byteLength": 36, "target": 34962},
{"buffer": 0, "byteOffset": 36, "byteLength": 6, "target": 34963}
],
"buffers": [{"byteLength": 44, "uri": "data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAAAAABAAIAAAA="}]
}'''
COMPONENT = {5121: ("B", 1), 5123: ("H", 2), 5125: ("I", 4), 5126: ("f", 4)}
WIDTH = {"SCALAR": 1, "VEC2": 2, "VEC3": 3, "VEC4": 4}
doc = json.loads(GLTF)
buffers = [base64.b64decode(b["uri"].split(",", 1)[1]) for b in doc["buffers"]]
def read(accessor_index):
acc = doc["accessors"][accessor_index]
view = doc["bufferViews"][acc["bufferView"]]
fmt, size = COMPONENT[acc["componentType"]]
n = WIDTH[acc["type"]]
start = view.get("byteOffset", 0) + acc.get("byteOffset", 0)
raw = buffers[view["buffer"]][start:start + acc["count"] * n * size]
flat = struct.unpack("<" + fmt * (acc["count"] * n), raw)
return [flat[i:i + n] for i in range(0, len(flat), n)]
print("glTF", doc["asset"]["version"], "by", doc["asset"]["generator"])
for node in doc["nodes"]:
mesh = doc["meshes"][node["mesh"]]
for prim in mesh["primitives"]:
positions = read(prim["attributes"]["POSITION"])
indices = [i[0] for i in read(prim["indices"])]
material = doc["materials"][prim["material"]]["name"]
print(f"node {node['name']!r} -> mesh {mesh['name']!r}: {len(positions)} vertices, "
f"{len(indices) // 3} triangle(s), material {material}")
print(" positions:", positions)
acc = doc["accessors"][prim["attributes"]["POSITION"]]
real_min = [min(p[k] for p in positions) for k in range(3)]
real_max = [max(p[k] for p in positions) for k in range(3)]
print(" min/max match accessor:", real_min == acc["min"] and real_max == acc["max"])
scale = node.get("scale", [1, 1, 1])
if scale != [1, 1, 1]:
print(f" WARNING: node scale {scale}; apply transforms before export")glTF 2.0 by hand-written example
node 'Crate' -> mesh 'CrateMesh': 3 vertices, 1 triangle(s), material M_Crate
positions: [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)]
min/max match accessor: True
WARNING: node scale [100, 100, 100]; apply transforms before export
That warning is the classic sign of a unit problem: a model built in centimetres whose exporter compensated with a ×100 node scale. It looks right, but physics, prefabs and code that read the scale get surprises. The Units, Axes & Scale lesson explains why it happens.
Production tools for glTF
- The glTF Validator (Khronos) checks a file against the spec; run it in CI on every exported asset.
- gltf-transform (CLI and JavaScript library) inspects, optimises, compresses (Draco, meshopt, KTX2) and resizes textures.
- gltfpack (from meshoptimizer) simplifies and compresses meshes and animations.
- three.js loads
.glbfiles in the browser withGLTFLoader; 3D Web Games with Three.js uses it.
FBX has no equivalent open toolchain: inspect FBX files in the engine's import window, Autodesk's FBX Review, or by importing them back into Blender.
Test yourself
Which units and up axis does the glTF 2.0 specification use?
- Centimetres, Z up
- Metres, Y up
- Whatever the exporter chooses
- Inches, Y up
In a glTF file, what does an accessor describe?
- A material
- How to read typed elements (type, component type, count) from a buffer view
- A camera
- A texture sampler
A model imports with a node scale of 100. What does that usually indicate?
- A high-resolution model
- A unit mismatch compensated with a scale instead of applied transforms
- Correct metres
- A LOD