glTF Bounding Boxes for Automatic AR Floor Placement
Accurate real-world placement is essential for convincing augmented
reality (AR) experiences, particularly when positioning virtual objects
on horizontal surfaces like floors. In the glTF (GL Transmission Format)
2.0 specification, bounding box dimensions are explicitly declared
through accessor min and max properties. This
article explains how AR runtimes use this pre-computed metadata to
calculate bottom-contact offsets, size placement reticles, and position
3D assets flush against detected physical surfaces instantly, without
the computational overhead of parsing raw vertex geometries.
Pre-Computed Spatial Metadata in glTF Accessors
In a glTF asset, 3D mesh geometry is broken down into buffers, buffer
views, and accessors. An accessor defines the data type, component type,
and spatial limits of an underlying buffer view. For vertex position
attributes (POSITION), the glTF specification requires the
accessor to define min and max arrays:
"accessors": [
{
"bufferView": 0,
"componentType": 5126,
"count": 3450,
"type": "VEC3",
"max": [1.2, 0.85, 0.4],
"min": [-1.2, -0.15, -0.4]
}
]These values represent the minimum and maximum coordinates of the geometry along the local X, Y, and Z axes, effectively defining an Axis-Aligned Bounding Box (AABB) in the asset's local object space.
Calculating the Ground Offset (Preventing Floating and Clipping)
The primary challenge in automatic AR floor placement is matching the model’s lowest geometric point to the plane detected by AR frameworks such as ARKit, ARCore, or WebXR.
3D artists frequently export models with origins (pivots) that are not located at the base of the mesh. An origin might be centered in the object, placed arbitrarily, or misaligned during CAD conversion.
AR engines read the minimum value of the vertical axis (typically
min[1] in a Y-up coordinate system) directly from the
accessor. The system calculates the vertical delta between the model's
local origin \((0, 0, 0)\) and its
lowest boundary point (\(Y_{min}\)):
\[\Delta Y = -Y_{min}\]
When the AR engine detects a horizontal surface at world height \(Y_{plane}\), it applies this offset to the root transform:
\[Y_{placement} = Y_{plane} + \Delta Y\]
This mathematical translation guarantees that the model rests flush on the floor plane, preventing the asset from either floating above the ground or clipping into the floor geometry.
Instant Ingestion Without Vertex Processing
Mobile and web-based AR runtimes face strict memory and processing budgets. A complex glTF file may contain hundreds of thousands of vertices stored in compressed or binary form (such as Draco or EXT_meshopt_compression).
Calculating an AABB at runtime by iterating over every vertex would
require decompressing geometry and performing \(O(N)\) comparisons across the entire vertex
buffer before placement could occur. Because glTF accessors store
min and max parameters directly in the JSON
header, an AR application reads the bounds in \(O(1)\) constant time upon parsing the
manifest. The engine can prepare the placement transform before the GPU
buffers have finished uploading or decompressing.
Dynamic Reticle and Footprint Sizing
Before a user confirms placement, AR interfaces typically project a dynamic bounding box or circular reticle onto the detected surface to show where the object will land.
By taking the difference between the maximum and minimum values of the horizontal axes:
\[\text{Width} = X_{max} - X_{min}\] \[\text{Depth} = Z_{max} - Z_{min}\]
The engine computes the exact footprint of the asset. This allows the AR system to:
- Scale the target reticle to match the object's physical dimensions.
- Evaluate whether the target detected plane provides enough continuous surface area to accommodate the asset.
- Automatically scale down oversized assets to fit smaller designated physical spaces if required.