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

Shader compilation failure when setting height map

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.4.0
    • Fix Version/s: None
    • Component/s: Quick: 3D
    • Labels:
      None
    • Sprint:
      2022 Qt Quick 3D: Week 19-20, 2022 Qt Quick 3D: Week 21-22, 2022 Qt Quick 3D: Week 25-26

      Description

      When baking a specific Quixel asset and creating a PrincipledMaterial that sets the heightMap, it fails with the following error message:

      NVD3DREL: GR-805 : DX9 Overlay is DISABLED
      QSpirvCompiler: Failed to parse shader
      Failed to compile fragment shader 
       
      "mesh default material pipeline-- ;hasLighting=true;hasIbl=true;lightCount=1;specularEnabled=true;fresnelEnabled=true;specularModel=KGGX;;diffuseMap={;;;;};emissiveMap={;;;;};specularMap={;;;;};baseColorMap={enabled=true;;;identity=true;};bumpMap={;;;;};specularAmountMap={;;;;};normalMap={enabled=true;;;identity=true;};clearcoatNormalMap={;;;;};opacityMap={;;;;};roughnessMap={enabled=true;;;identity=true;};metalnessMap={;;;;};occlusionMap={;;;;};translucencyMap={;;;;};heightMap={enabled=true;;;identity=true;};clearcoatMap={;;;;};clearcoatRoughnessMap={;;;;};transmissionMap={;;;;};thicknessMap={;;;;};opacityMap_channel=R;roughnessMap_channel=G;metalnessMap_channel=R;occlusionMap_channel=R;translucencyMap_channel=R;heightMap_channel=R;clearcoatMap_channel=R;clearcoatRoughnessMap_channel=R;transmissionMap_channel=R;thicknessMap_channel=R;boneCount=0;alphaMode=Default;;vertexAttributes={position=true;normal=true;texcoord0=true;;;;}};morphTargetCount=0;morphTarget0Attributes={;;;;;;}};morphTarget1Attributes={;;;;;;}};morphTarget2Attributes={;;;;;;}};morphTarget3Attributes={;;;;;;}};morphTarget4Attributes={;;;;;;}};morphTarget5Attributes={;;;;;;}};morphTarget6Attributes={;;;;;;}};morphTarget7Attributes={;;;;;;}}" 
       "ERROR: :856: 'qt_NormalMap_uv_coords1' : undeclared identifier \nERROR: :856: '=' :  cannot convert from ' global float' to ' temp highp 2-component vector of float'\nERROR: :856: '' : compilation terminated \nERROR: 3 compilation errors.  No code generated."
      

      Commenting out the heightMap makes it work.

      Note that I tried reproducing this with a #Cube and some cc00 textures for the bug report, and it does not reproduce there, so there might be something going wrong with baking the model. I ran balsam on the LOD0 mesh with no extra parameters.

      The code used to show it is a modified version of the runtimeloader example (note files have been renamed from the source data):

      /****************************************************************************
      **
      ** Copyright (C) 2021 The Qt Company Ltd.
      ** Contact: https://www.qt.io/licensing/
      **
      ** This file is part of the examples of the Qt Toolkit.
      **
      ** $QT_BEGIN_LICENSE:BSD$
      ** Commercial License Usage
      ** Licensees holding valid commercial Qt licenses may use this file in
      ** accordance with the commercial license agreement provided with the
      ** Software or, alternatively, in accordance with the terms contained in
      ** a written agreement between you and The Qt Company. For licensing terms
      ** and conditions see https://www.qt.io/terms-conditions. For further
      ** information use the contact form at https://www.qt.io/contact-us.
      **
      ** BSD License Usage
      ** Alternatively, you may use this file under the terms of the BSD license
      ** as follows:
      **
      ** "Redistribution and use in source and binary forms, with or without
      ** modification, are permitted provided that the following conditions are
      ** met:
      **   * Redistributions of source code must retain the above copyright
      **     notice, this list of conditions and the following disclaimer.
      **   * Redistributions in binary form must reproduce the above copyright
      **     notice, this list of conditions and the following disclaimer in
      **     the documentation and/or other materials provided with the
      **     distribution.
      **   * Neither the name of The Qt Company Ltd nor the names of its
      **     contributors may be used to endorse or promote products derived
      **     from this software without specific prior written permission.
      **
      **
      ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
      ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
      ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
      ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
      ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
      ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
      **
      ** $QT_END_LICENSE$
      **
      ****************************************************************************/
      
      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls
      
      import Qt.labs.platform
      import Qt.labs.settings
      
      import QtQuick3D
      import QtQuick3D.Helpers
      import QtQuick3D.AssetUtils
      
      Window {
          visible: true
          width: 800
          height: 600
      
          //! [base scene]
          View3D {
              id: view3D
              anchors.fill: parent
              environment: SceneEnvironment {
                  probeExposure: 0.0
                  backgroundMode: SceneEnvironment.SkyBox
                  temporalAAEnabled: true
                  lightProbe: Texture {
                      source: "maps/OpenfootageNET_lowerAustria01-1024.hdr"
                  }
      
              }
      
      //        DirectionalLight {
      //            eulerRotation: "-30, -20, -40"
      //            //ambientColor: "#333"
      //            color: "#ffffff"
      //            brightness: 0.3
      //            castsShadow: true
      //        }
      
      
              PerspectiveCamera {
                  id: camera
                  position: "0, 150, 400"
                  Component.onCompleted: view3D.resetView()
              }
      
          //! [base scene]
      
      
              function resetView() {
                  camera.position = "0, 150, 400"
                  camera.eulerRotation = "-15, 0, 0"
                  //importNode.eulerRotation = "0, 0, 0"
                  helper.resetScale()
                  helper.resetPosition()
              }
      
              //! [instancing]
              //! [instancing]
      
              QtObject {
                  id: helper
                  property real boundsDiameter: 0
                  property vector3d boundsCenter
                  property vector3d boundsSize
                  property alias scaleFactor: wheelHandler.factor
                  property alias position: importNode.position
      
                  function resetScale() {
                      wheelHandler.factor = boundsDiameter ? 300 / boundsDiameter : 1.0
                  }
                  function resetPosition() {
                      position = Qt.vector3d(-boundsCenter.x*scaleFactor, -boundsCenter.y*scaleFactor, -boundsCenter.z*scaleFactor)
                  }
      
                  function updateBounds(bounds) {
                      boundsSize = Qt.vector3d(bounds.maximum.x - bounds.minimum.x,
                                               bounds.maximum.y - bounds.minimum.y,
                                               bounds.maximum.z - bounds.minimum.z)
                      boundsDiameter = Math.max(boundsSize.x, boundsSize.y, boundsSize.z)
                      boundsCenter = Qt.vector3d((bounds.maximum.x + bounds.minimum.x) / 2,
                                                 (bounds.maximum.y + bounds.minimum.y) / 2,
                                                 (bounds.maximum.z + bounds.minimum.z) / 2 )
                      console.log("Bounds changed: ", bounds.minimum, bounds.maximum,
                                  " center:", boundsCenter, "diameter:", boundsDiameter)
                      view3D.resetView()
                  }
              }
      
              //! [bounds]
              PrincipledMaterial {
                  id: default_material_material
                  baseColorMap: Texture { source: "file:albedo.jpg" }
                  normalMap: Texture { source: "file:normal.jpg" }
                  roughnessMap: Texture { source: "file:roughness.jpg" }
                  heightMap: Texture { source: "file:displacement.jpg" }
              }
      
              Model {
                  id: importNode
                  source: "file:asset.mesh"
                  scale: Qt.vector3d(helper.scaleFactor, helper.scaleFactor, helper.scaleFactor)
                  onBoundsChanged: helper.updateBounds(bounds)
                  eulerRotation: Qt.vector3d(-90, 0, 180)
                  receivesShadows: true
                  castsShadows: true
                  materials: [
                      default_material_material
                  ]
      
                  PointLight {
                      position: importNode.bounds.maximum.plus(Qt.vector3d(-100, 100, -100))
                      color: "#ffffff"
                      castsShadow: true
                  }
      
              }
              //! [bounds]
          }
      
          //! [camera control]
          WasdController {
              controlledObject: camera
          }
      
          WheelHandler {
              id: wheelHandler
              property real factor: 10.0
              onWheel: (event)=> {
                  if (event.angleDelta.y > 0)
                      factor *= 1.1
                  else
                      factor /= 1.1
             }
          }
      
          PointHandler {
              id: rotateHandler
              acceptedButtons: Qt.MiddleButton
              onPointChanged: {
                  if (Math.abs(point.velocity.x) >= Math.abs(point.velocity.y))
                      importNode.eulerRotation.y += point.velocity.x / 2000
                  else
                      importNode.eulerRotation.x += point.velocity.y / 2000
              }
          }
          //! [camera control]
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.graphics.and.multimedia Qt Graphics Team
            Reporter:
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes