Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt3D Transform{} skew uncompatible?
Forum Updated to NodeBB v4.3 + New Features

Qt3D Transform{} skew uncompatible?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 4 Posters 1.9k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sylcS Offline
    sylcS Offline
    sylc
    wrote on last edited by
    #1

    I'm trying to implement the following transformation in Qt3D: fit a textured rectangle in an arbitrary quaternion.

    I've found the calculation of the transformation 4x4 matrix on the internet and it works very well in 2D QtQuick. Then I tried to bring the same matrix to Qt3D and failed. From what I see Qt3D doesn't want to distort the objects same as QtQuick does. However simple affine transformations like translations, rotations and scale do work very well in Qt3D. Skew doesn't.

    I don't believe Qt3D treats transformation matrices in a different way that all other frameworks. I must have missed something. Is it possible Qt3D clears certain 'non-important' matrix values?

    Sources: https://drive.google.com/open?id=0BxC-DMpqMeoKZkkwc1ZQM3FVNHc
    The test application has all controls to dynamically play with the matrices and transformations.

    Any ideas appreciated. Thanks!

    A good guide to 4x4 transformations: https://www.w3.org/TR/css-transforms-1/#mathematical-description

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I'd recommend bringing this question to the interest mailing list. You'll find there Qt3D's developers/maintainers. This forum is more user oriented.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • sylcS Offline
        sylcS Offline
        sylc
        wrote on last edited by
        #3

        Finally I've found the problem root cause:
        The Qt3D's Transform { ... } is compatible with affine transformations ONLY.
        It means you cannot load an arbitrary matrix into Transform and expect it to work.
        After receiving a matrix they decompose it to translation, rotations and scale and compose a new matrix basing on these values. Sucks.

        ? 1 Reply Last reply
        1
        • sylcS sylc

          Finally I've found the problem root cause:
          The Qt3D's Transform { ... } is compatible with affine transformations ONLY.
          It means you cannot load an arbitrary matrix into Transform and expect it to work.
          After receiving a matrix they decompose it to translation, rotations and scale and compose a new matrix basing on these values. Sucks.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @sylc Interesting. How did you find out?

          sylcS 1 Reply Last reply
          0
          • ? A Former User

            @sylc Interesting. How did you find out?

            sylcS Offline
            sylcS Offline
            sylc
            wrote on last edited by
            #5

            @Wieland

            Looks like I will need to implement a "RawTransform { matrix: m }" QML class that would accept only a matrix and do no calculations at all.

            How did I find out: Qt3D sources, file qtransform.cpp contains a matrix setter

            void QTransform::setMatrix(const QMatrix4x4 &m)
            {
                Q_D(QTransform);
                if (m != matrix()) {
                    d->m_matrix = m;
                    d->m_matrixDirty = false;
            
                    QVector3D s;
                    QVector3D t;
                    QQuaternion r;
                    decomposeQMatrix4x4(m, t, r, s);
                    d->m_scale = s;
                    d->m_rotation = r;
                    d->m_translation = t;
                    d->m_eulerRotationAngles = d->m_rotation.toEulerAngles();
                    emit scale3DChanged(s);
                    emit rotationChanged(r);
                    emit translationChanged(t);
            
                    const bool wasBlocked = blockNotifications(true);
                    emit matrixChanged();
                    emit scaleChanged(d->m_scale.x());
                    emit rotationXChanged(d->m_eulerRotationAngles.x());
                    emit rotationYChanged(d->m_eulerRotationAngles.y());
                    emit rotationZChanged(d->m_eulerRotationAngles.z());
                    blockNotifications(wasBlocked);
                }
            }
            
            1 Reply Last reply
            0
            • M Offline
              M Offline
              mcallegari79
              wrote on last edited by mcallegari79
              #6

              Hey guys, just found this thread.
              Is this related to what I found here ? https://bugreports.qt.io/browse/QTBUG-58987

              That issue is blocking my project and apprently the Qt3D folks don't seem to be interested in fixing it.
              I definitely need to use nested meshes and be able to freely transform each submesh.
              Cheers

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved