Qt 6.11 is out! See what's new in the release
blog
Qt Quick3D: Unable to Load STL/STEP/GLB Models in QML (Works Only with .mesh from Balsam)
-
Description:
I’m working on a Qt Quick3D application and facing issues loading 3D model files in QML.
Project Setup
- Qt version: 6.8
- Modules used: Quick, Quick3D, QuickEffects, Network, WebSockets, Charts
- CMake-based project
I’ve included my CMake configuration below:
cmake_minimum_required(VERSION 3.16) project(appsampleUI VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 REQUIRED COMPONENTS Quick Quick3D QuickEffects Network WebSockets Charts) qt_standard_project_setup(REQUIRES 6.8) qt_add_executable(appsampleUI main.cpp) qt_add_qml_module(appsampleUI URI sampleUI VERSION 1.0 QML_FILES Main.qml .........etc SOURCES SharedData.h .........etc RESOURCES .........etc ) qt_add_resources(appsampleUI "assets" FILES meshes/bg.png meshes/logo.png meshes/link0.mesh meshes/link1.mesh meshes/link2.mesh meshes/link3.mesh meshes/link4.mesh meshes/link5.mesh meshes/m0.mesh meshes/m1.mesh meshes/m2.mesh ) target_link_libraries(appsampleUI PRIVATE Qt6::Quick Qt6::Quick3D Qt6::QuickEffects Qt6::Network Qt6::WebSockets Qt6::Charts )
Issue
-
When I use
.meshfiles generated using Qt Balsam, the models load correctly in QML. -
However, when I try to load other formats like:
.stl.step.glb
I get errors indicating that the files cannot be found or are not loaded.
Questions
- Does Qt Quick3D support loading
.stl,.step, or.glbfiles directly in QML? - If not, what is the recommended workflow for using these formats?
- Is conversion to
.meshusing Balsam mandatory for all 3D assets? - Could this issue be related to how resources are added in CMake (e.g.,
qt_add_resources)?
Additional Notes
- Resource paths are referenced using the
:/assets/prefix. .meshfiles work fine from the same resource location.- Only non-mesh formats fail to load.
Any guidance or best practices for handling 3D model formats in Qt Quick3D would be greatly appreciated.
Thanks in advance!