[Interest] [Qt3d] Rendering 3D object with 2D coordinates

Federico Ferri federico.ferri.it at gmail.com
Mon Mar 15 11:18:41 CET 2021


The 3D coordinates are *world coordinates*, and their units is whatever you
like, e.g. you can have a cube of size 0.1, 1, or 100, and with appropriate
camera settings, it will appear the same onto the window/device.

2D *window coordinates* are another thing.

For going to world coords to window coords points are (left) multiplied by
the view matrix, then by the projection matrix, then coordinates are
scaled/translated to render in the window/viewport (this is not specific to
Qt3D, it's just basic OpenGL).

Going the other way round (back-projection) can be done by e.g.
QVector3D::unproject()

On Mon, Mar 15, 2021 at 11:03 AM Alex john <blackbriar153 at 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 at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210315/9c002054/attachment.html>


More information about the Interest mailing list