Add a native glTF 2.0 asset importer
Introduce a "gltf" asset importer plugin built on the Quick3DGltf
document model, behind a new on-by-default quick3d-gltf feature. It
takes over the gltf and glb extensions from the Assimp plugin in both
balsam and RuntimeLoader, with Assimp kept as a lower-priority
fallback. Setting QT_QUICK3D_DISABLE_NATIVE_GLTF routes glTF assets
through Assimp during the transition.
Output differs from the Assimp importer where the native importer
follows the specification more closely. STEP interpolation holds
values, consecutive quaternion keys stay in the same hemisphere, and
tangents are generated (using the already vendored meshoptimizer) for
normal-mapped meshes that lack them. Assets requiring an extension the
importer does not support are rejected instead of loading with the
extension ignored.
Missing normals are generated flat, as the specification mandates.
--generateSmoothNormals opts into smooth normals instead, and unlike
the Assimp option of the same name it defaults to off.
This also fixes a balsam crash on every import in builds without the
Assimp plugin, as removeFlagConflicts() dereferenced command line
options that only that plugin declares.
[ChangeLog][Asset Import] glTF 2.0 assets (.gltf/.glb) are now imported
by a new native importer built on Qt instead of the Assimp library, in
both balsam and RuntimeLoader. It covers the core glTF 2.0 feature set
and common KHR extensions, and rejects assets requiring
KHR_draco_mesh_compression or KHR_texture_basisu with a clear error. Set
QT_QUICK3D_DISABLE_NATIVE_GLTF to restore the previous behavior.
[ChangeLog][Third-Party Code] meshoptimizer is now also used to weld
vertices and to generate tangents for Models in Qt Quick 3D, in addition
to generating levels of detail. No new third-party code was added.
Task-number: QTBUG-148576
Change-Id: If42a8244a7804677aad64b82f7572d0a46f89cfb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
| commit | fb41a317aeaae7ff7294511c5c9d47237fe15d7b |
| parent | 3cb94b6159db81a84a98004dd00021ce2b9a393a |
| author | Andy Nichols <andy.nichols@qt.io> |
| committer | Andy Nichols <andy.nichols@qt.io> |
| commit time | Tue, 29 Sep 2026 11:21:59 +0000 |
- M src/3rdparty/meshoptimizer/qt_attribution.json
- M src/assetutils/qquick3druntimeloader.cpp
- M src/plugins/assetimporters/CMakeLists.txt
- M src/plugins/assetimporters/configure.cmake
- A src/plugins/assetimporters/gltf/CMakeLists.txt
- A src/plugins/assetimporters/gltf/gltf.json
- A src/plugins/assetimporters/gltf/gltfimporter.cpp
- A src/plugins/assetimporters/gltf/gltfimporter.h
- A src/plugins/assetimporters/gltf/gltfimporterplugin.cpp
- A src/plugins/assetimporters/gltf/gltfimporterplugin.h
- A src/plugins/assetimporters/gltf/gltfmeshbuilder.cpp
- A src/plugins/assetimporters/gltf/gltfmeshbuilder.h
- A src/plugins/assetimporters/gltf/gltfsceneconverter.cpp
- A src/plugins/assetimporters/gltf/gltfsceneconverter.h
- A src/plugins/assetimporters/gltf/options.json
- M src/quick3d/doc/src/qtquick3d-tool-balsam.qdoc
- M src/utils/CMakeLists.txt
- M src/utils/qssgmesh.cpp
- M src/utils/qssgmesh_p.h
- M tests/auto/assetimport/tst_assetimport.cpp
- A tests/auto/quick3d_visual/runtimeloader/data/animquad.gltf
- A tests/auto/quick3d_visual/runtimeloader/data/checker.png
- A tests/auto/quick3d_visual/runtimeloader/data/extmats.gltf
- A tests/auto/quick3d_visual/runtimeloader/data/morphquad.gltf
- A tests/auto/quick3d_visual/runtimeloader/data/nativegltf.qml
- A tests/auto/quick3d_visual/runtimeloader/data/quad.bin
- A tests/auto/quick3d_visual/runtimeloader/data/simpleskin.gltf
- A tests/auto/quick3d_visual/runtimeloader/data/texquad.gltf
- M tests/auto/quick3d_visual/runtimeloader/tst_runtimeloader.cpp
- M tests/auto/utils/mesh/tst_mesh.cpp
- A tests/baseline/data/gltf/checker.png
- A tests/baseline/data/gltf/extmats.gltf
- A tests/baseline/data/gltf/materialextensions.qml
- A tests/baseline/data/gltf/quad.bin
- A tests/baseline/data/gltf/smoothgeometry.qml
- A tests/baseline/data/gltf/sphere.bin
- A tests/baseline/data/gltf/sphere.gltf
- A tests/baseline/data/gltf/texquad.gltf
- A tests/baseline/data/gltf/texturetransform.qml
- A tests/manual/gltf-compare/gltf-compare.py
- A tests/manual/gltf-samples/gltf-samples.qml
- M tools/balsam/main.cpp