What is the MSFT_lod Extension in glTF?
This article provides an overview of the MSFT_lod
extension in glTF 2.0, detailing its purpose, structure, and operational
mechanics. You will learn what the extension is, how it organizes
discrete geometric detail levels within a 3D asset, and how runtime 3D
rendering engines evaluate screen coverage metrics to dynamically swap
meshes for performance optimization.
What is MSFT_lod?
MSFT_lod is a vendor extension developed by Microsoft
for the glTF (GL Transmission Format) 2.0 specification. Its primary
purpose is to define discrete Level of Detail (LOD) representations
directly within a single glTF file.
In real-time 3D rendering, drawing fully detailed, high-polygon
meshes at large distances from the camera wastes computational
resources. MSFT_lod solves this by grouping multiple
versions of an asset—ranging from high-polygon to low-polygon
variants—into a hierarchical structure, allowing engines to render only
the mesh complexity necessary for a given viewing distance.
How MSFT_lod Swaps Mesh Detail Levels
The extension functions by linking alternative nodes (or materials) to a primary, highest-detail node using an index array and visibility thresholds based on screen coverage.
1. Defining the Hierarchy
In the glTF scene graph, the highest-detail mesh serves as the
primary node. Lower-detail variants are defined as separate nodes within
the file's nodes array. The primary node references these
secondary nodes using the extensions.MSFT_lod block.
The extension introduces two primary properties:
ids: An array of node indices pointing to the lower-detail fallback meshes, ordered from highest to lowest detail.screenCoverage: An array of floating-point values between 0.0 and 1.0 that specify the threshold at which the runtime should switch between levels.
A simplified JSON representation looks like this:
{
"nodes": [
{
"name": "Mesh_LOD0_High",
"mesh": 0,
"extensions": {
"MSFT_lod": {
"ids": [1, 2],
"screenCoverage": [0.5, 0.2]
}
}
},
{
"name": "Mesh_LOD1_Medium",
"mesh": 1
},
{
"name": "Mesh_LOD2_Low",
"mesh": 2
}
]
}2. Screen Coverage Evaluation
During each frame, the 3D rendering engine calculates the asset's current screen-space coverage. Screen coverage is typically measured by projecting the object's bounding sphere onto the viewport and determining the ratio of the screen area occupied by the object relative to the total viewport size.
- High Detail (LOD 0): Used when the object occupies more screen area than the first threshold (e.g., coverage > 0.5).
- Medium Detail (LOD 1): Swapped in when coverage drops between the first and second thresholds (e.g., 0.2 <= coverage <= 0.5).
- Low Detail (LOD 2): Swapped in when coverage falls below the final threshold (e.g., coverage < 0.2).
3. Runtime Swapping
When a threshold is crossed:
- The engine hides or disables rendering for the active node.
- The engine enables the corresponding fallback node defined in
ids. - Transformations applied to the root node typically propagate down, ensuring that the alternate mesh maintains the correct position, rotation, and scale in the scene.
Summary of Benefits
By embedding LOD logic directly into the glTF standard,
MSFT_lod allows content creators to package
multi-resolution models into a single file. Supported runtime engines
(such as Babylon.js and Three.js) can automatically handle level
swapping, significantly reducing GPU geometry processing loads and
improving frame rates without requiring custom engine-side LOD code.