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

CutsomMaterial model specific properties

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • P3: Somewhat important
    • 6.x
    • 6.0.0
    • Quick: 3D
    • None
    • Windows
    • 5

    Description

      It is possible to use one material for multiple models this way:

       

      Model
      {
          ...
          materials: [
              material1
          ]
      }
      Model
      {
          ...
          materials: [
              material1
          ]
      }
      Model
      {
          ...
          materials: [
              material1
          ]
      }
      
      CustomMaterial
      {
          id: material1
          baseColor: "red"
      }
      

      It works, but if the CustomMaterial should work in a slightly different way for each model, then a separate instance of CustomMaterial has to be created for each model. If there are hundreds of models and the CustomMaterial is complicated it leads to huge overhead.

      I would suggest 3 ways to solve this problem:

      1) add  MODEL_INDEX property to CustomMaterial shader. The index should be set in each Model instance and it will be possible to distinguish the models in the attached shader.

      2) add "materialProperties" property to Model:

       

      Model
      {
          materialProperties: MaterialPropertues
          {
              property var baseColor: "red"
          }
      }

      The property value will be available in the attached shader.

      3) Add "currentModel" property to CustomMaterial:

      CustomMaterial
      {
          property var baseColor: currentModel.color
      }

      This way it will be possible to set different color for each Model with using only one CustomMaterial instance.

       

       

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            alexey89 alexey89
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes