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

Scene3D.Underlay + RenderSettings.OnDemand can lead to rendering errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.14.2, 5.15.0 Beta4
    • Qt3D
    • None

    Description

      If only the 2D scene is changing, then OnDemand will determine that nothing changed and will not paint the 3D scene. This means clear() is not called, and 2D content starts rendering over itself. The example below demonstrates; note how the Rectangle becomes a circle:

      import QtQuick 2.14
      import QtQuick.Scene3D 2.14
      import Qt3D.Core 2.0
      import Qt3D.Render 2.15
      import Qt3D.Input 2.0
      import Qt3D.Extras 2.15
      
      Item {
          width: 800
          height: 800
      
          Scene3D {
              anchors.fill: parent
              aspects: ["input", "logic"]
              compositingMode: Scene3D.Underlay
      
              Entity {
                  id: sceneRoot
      
                  Camera {
                      id: camera
                      fieldOfView: 45
                      position: Qt.vector3d( 0.0, 0.0, 40.0 )
                      upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
                  }
      
                  components: [
                      RenderSettings {
                          id: renderSettings
                          activeFrameGraph: ForwardRenderer {
                              camera: camera
                              clearColor: "black"
                          }
                          renderPolicy: RenderSettings.OnDemand
                      },
                      InputSettings { }
                  ]
      
                  PhongMaterial {
                      id: material
                  }
      
                  TorusMesh {
                      id: torusMesh
                      radius: 5
                      minorRadius: 1
                      rings: 100
                      slices: 20
                  }
      
                  Transform {
                      id: torusTransform
                      scale3D: Qt.vector3d(1.5, 1, 0.5)
                      rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
                  }
      
                  Entity {
                      id: torusEntity
                      components: [ torusMesh, material, torusTransform ]
                  }
              }
          }
      
          Rectangle {
              width: 100
              height: 100
              anchors.centerIn: parent
              color: "red"
      
              NumberAnimation on rotation {
                  from: 0; to: 360; duration: 3000
              }
          }
      }
       

      Attachments

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

        Activity

          People

            seanharmer Sean Harmer
            mbrasser Michael Brasser
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes