CNA-GAP-036: Runtime glTF import has no unit-scale option; only the offline converters can rescale a model
Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
ContentManager's glTF reader always imports at unitScale 1.0, so a file not authored in metres must go through the offline converters: cna_tool_gltf_to_cnb --unit-scale, or the optional unitScale argument of cna_tool_gltf_to_cnj.
- Identifier
CNA-GAP-036- Category
- Functional gap
- Subsystem
- Models & glTF
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- None
- Affected contract
- ContentManager::Load<Model> on .gltf/.glb
Expected behaviour
glTF is defined in metres, but many assets are authored in other units; an importer is expected to offer a scale, as CNA's offline tools do.
Actual behaviour at TARGET
The runtime reader in ContentManager.cpp passes 1.0f to every extraction step, and its own comment records the limit: "unitScale is always 1.0 (no CLI-argument equivalent exists for runtime loading); a source file not authored in meters needs the offline tool instead." gltf_to_cnb.cpp accepts --unit-scale <f>; gltf_to_cnj.cpp takes an optional fourth positional argument, unitScale.
Source locations
modules/content/src/Xna/ContentManager.cpp— ReadGltfModel: 1.0f unitScale arguments and the documented-limitation commenttools/gltf_to_cnb/gltf_to_cnb.cpp— --unit-scale optiontools/gltf_to_cnj/gltf_to_cnj.cpp— --unit-scale option
Evidence
Checked by reading at 009d40f5; not executed.
Independent re-verification: Checked by reading at 009d40f5; not executed. Correction: the original text said both tools accept --unit-scale; only gltf_to_cnb does. Workaround wording: convert with gltf_to_cnb --unit-scale or gltf_to_cnj's positional unitScale, or apply a scale to the world matrix when drawing. Offline scaling is exercised by GltfToCnjToolTests.cpp.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
Scaling is tested through the offline tools; the runtime route has no scale to test.
Regression test
If a runtime option is added (for example on a glTF load-options object), a test that a scaled load matches the tool's scaled output.
Blast radius
Applications that load non-metre glTF files at run time.
Workaround
Convert with --unit-scale, or apply a scale to the world matrix when drawing.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- User guide
- Model loading: runtime glTF
- Deep dives
- glTF import: the import report
- Known issues
- Functional gap index