Unsolved QT3d.render view3D how to set "ambientColor" property
-
during my study about qml 3d ambient, I try to start teapot example .... But when try to load myblenderimage.obj instead of terapot.mesh I had to activate the Qt3D.core and Qt3D.render imports. This has meant that the diffused light of the environment became a mistake .... and now I can't understand how to set the ambient light correctly. My code:
Rectangle { id: animation x: 120 y: 60 width: 760 height: 560 color: "#00000000" border.color: "#25bb5c" anchors.top: parent.top anchors.topMargin: 60 /* start node of camea */ // The root scene //! [rootnode] Node { id: standAloneScene //! [rootnode] DirectionalLight { ambientColor: Qt.rgba(1.0, 1.0, 1.0, 1.0) //color: Qt.rgb(255, 255, 255) } Model { id: startingRotation source: "#Cube" y: -134 scale: Qt.vector3d(3, 3, 0.1) eulerRotation.x: -90 materials: [ DefaultMaterial { diffuseColor: Qt.rgba(0.8, 0.8, 0.8, 1.0) } ] } Model { id: sphere source: "#Sphere" y: -113 scale: Qt.vector3d(0.3, 0.3, 0.3) DefaultMaterial { id: sphereMaterial diffuseColor: "#ff0f0f" } materials: sphereMaterial } Model { id: startModel //source: Krcol source: "render-obj-my/my.qml" //source: "mesh/teapot.mesh" y: -100 scale: Qt.vector3d(50, 50, 50) materials: [ PrincipledMaterial { id: startMaterial baseColor: "#41cd52" metalness: 0.75 roughness: 0.1 specularAmount: 1.0 indexOfRefraction: 2.5 opacity: 1.0 emissiveColor: "#53ad31" } ] PropertyAnimation on eulerRotation.y { id: startAnimation //running: true //target: startModel loops: Animation.Infinite duration: 5000 to: 0 from: -360 } }
my.qml is an obj file converted to mesh using Balsam tool .... in a terminal "pathWhereIsExecutableBalsam pathWhereIsFileOrigina.obj -o pathWhereIsConvertedFile" using these command Balsam create my.qml file and a folder named "meshes" where save all "meshes/solid1_1.mesh" result from operation .... my.qml file is a Node with multiple model, every model load a mesh file .... in my case 14 file.mesh.
Now I have 2 issue:
- because import Qt3D.Render
DirectionalLight { ambientColor: Qt.rgba(1.0, 1.0, 1.0, 1.0) //color: Qt.rgb(255, 255, 255) }
Result as an error .... so I eliminate "ambientColor: Qt.rgba(1.0, 1.0, 1.0, 1.0)" .... but not able to create the same light effect .... how can make these?
- Second issue, with "import Qt3D.Core" mypage.qml generates the error: file or folder does not exist
Someone know the reasons?
Regards
bkt