Unsolved Qt3D - STL/PLY/OBJ meshes not showing up
-
Hello. I am having problem with a QML component that is supposed to display meshes. In the QML code below, I try to display a cone (parametric mesh) as well as a mesh read in from a PLY file (embedded in my resource file). Only the cone shows up. I see no suspicious messages on the console.
I have tried to launch the application with GammaRay and click on Qt 3D Inspector. It seems like only the cone has buffers attached to it. I have tried various meshes in different formats (PLY, STL, OBJ etc.) as well as the SceneLoader component, but I have still not managed to display scenes or meshes that are loaded from disk (or embedded in the resource file).
When I copy in the same code to a simple, standalone application (e.g. the scene3d example from Qt 3D), the meshes (PLY, OBJ etc.) appear without problems.
What might be wrong and how may I proceed to debug this problem?
I am running Qt 5.12.9. (I need to use this version, since the application I am trying to integrate the component into depends on this specific version of Qt).
import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 import QtQuick.Scene3D 2.0 import Qt3D.Core 2.0 as Q3D import Qt3D.Render 2.0 import Qt3D.Input 2.0 import Qt3D.Extras 2.0 Rectangle { id: pointCloudView Layout.fillWidth: true Layout.fillHeight: true Scene3D { id: scene3d objectName: "scene3d" aspects: ["input", "logic"] cameraAspectRatioMode: Scene3D.AutomaticAspectRatio anchors.fill: parent focus: true Q3D.Entity { id: sceneRoot Camera { id: mainCamera projectionType: CameraLens.PerspectiveProjection fieldOfView: 75 aspectRatio: scene3d.width/scene3d.height nearPlane : 0.1 farPlane : 1000.0 position: Qt.vector3d( 10.0, 0.0, 0.0 ) viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) } OrbitCameraController { camera: mainCamera } components: [ RenderSettings { activeFrameGraph: Viewport { id: viewport normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0) RenderSurfaceSelector { CameraSelector { id : cameraSelector camera: mainCamera FrustumCulling { ClearBuffers { buffers : ClearBuffers.ColorDepthBuffer clearColor: "black" } } } } } }, InputSettings { enabled: true } ] Mesh { id: plyMesh source: "qrc:/res/bunny.ply" } ConeMesh { id: coneMesh bottomRadius: 0.3 length: 0.5 rings: 10 slices: 10 } Q3D.Transform { id: plyTransform } Q3D.Transform { id: coneTransform translation: Qt.vector3d(-10,0,0) } PhongMaterial { id: phongMaterial } Q3D.Entity { id: coneEntity components: [ coneMesh, coneTransform, phongMaterial ] } Q3D.Entity { id: plyEntity components: [ plyMesh, plyTransform, phongMaterial ] } } } }