I did the following changes to the wireframe example (Trefoilknot.qml file translation property of transform) but still unable to get the modelView Matrix, and also not sure whether the following changes to translation are right If anyone can confirm and let me know
property var mainCam // got the mainCamera ID from main.qml (wireframe example) property var forwardRenderer //forwardRendered id from main.qml (wireframe example) Transform { id: trefoilMeshTransform *translation:Qt.vector3d(Qt.vector2D(4, 4)).unproject( *modelView* ,mainCam.projectionMatrix, forwardRenderer.viewportRect)* property real theta: 0.0 property real phi: 0.0 property real roll: 0.0 rotation: fromEulerAngles(theta, phi, roll) scale: root.scale } /* *translation* : Qt.vector2D(100, 100) is where I intend to give window 2d coordinates(here its x:100, y:100)and I assume that unproject api will convert the 2d points to 3d and renders the 3d object exactly at 100, 100 pixel 2d location */ I got the projectionMatrix from camera, viewPortRect from ForwardRenderer in Rendering settings. I'm completely stuck for this step. If anyone can please confirm the changes and let me know the modelView matrix. On Mon, Mar 15, 2021 at 5:14 PM Alex john <blackbriar...@gmail.com> wrote: > > Going the other way round (back-projection) can be done by e.g. > QVector3D::unproject() > > Thanks, as I'm referring the the wireframe example I was able to get > the camera projection matrix from Camera Qml. However, I'm unsure how > to get the ModelView matrix and the viewport. > > As I have loaded my custom obj in wireframe example and using the same > geometry and camera settings as its for wireframe, therefore can you > please let me know how this can be done at QML side? I did try to find > this in the documentation but didn't find the usage. > > > > > > On Mon, Mar 15, 2021 at 11:03 AM Alex john <blackbriar...@gmail.com> > wrote: > >> > >> Hello , > >> > >> Im successessfully able to load the obj file in Scene3D, and by using > >> fromEulerAngles I'm able to get the required yaw, pitch and > >> roll.However, I'm not able to use the right translation to get the > >> object rendered. I get the x,y coordinates in pixels from the other > >> module and I need to render the 3d model exactly at that pixel > >> location. It turns out that the Transform type has translation and it > >> takes the input in 3d coordinates (not sure which unit) if I try to > >> assign the x,y coordinates to the 3d coordinates it renders somewhere > >> else. Seems like the x,y in the translation is not the pixel 2d > >> values, as even with a x=0.3 it deflects more than expected. > >> > >> Is there a way to assign the x,y 2d pixel values (as we do for > >> Rectangle {x: 100, y:100}) to the translation so that it is rendered > >> to the right place where it's desired. > >> _______________________________________________ > >> Interest mailing list > >> Interest@qt-project.org > >> https://lists.qt-project.org/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest