Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82977

Simple custom material example shader may use wrong matrix

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.14.0
    • Qt3D
    • None

    Description

      Simple custom material example's shader may use wrong matrix.

       

      https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/simplecustommaterial/shaders/es2/simpleColor.vert?h=5.14
      https://code.qt.io/cgit/qt/qt3d.git/tree/examples/qt3d/simplecustommaterial/shaders/gl3/simpleColor.vert?h=5.14

      ----
      // Transform position, normal, and tangent to world coords
      worldPosition = vec3(modelMatrix * vec4(vertexPosition, 1.0));
      {{// Calculate vertex position in clip coordinates }}
      gl_Position = mvp * vec4(worldPosition, 1.0);
      ----

      mvp is model/view/projection matrix.  But, worldPosition already have model matrix.  gl_Position multiples model matrix 2 times.

      I think correct code is


      gl_Position = viewProjectionMatrix * vec4(worldPosition, 1.0);
      ----

      {{}}

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            seanharmer Sean Harmer
            taku_shikina Taku Shikina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes