Pārlūkot izejas kodu

add forceMetallicWorkflow flag and enable for pbrMetallicRoughnessMaterial

Kacey Coley 7 gadi atpakaļ
vecāks
revīzija
2f3b328ea6

+ 6 - 1
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -428,6 +428,11 @@
         protected _forceNormalForward = false;
 
         /**
+         * Force metallic workflow.
+         */
+        protected _forceMetallicWorkflow = false;
+
+        /**
          * Default configuration related to image processing available in the PBR Material.
          */
         @serializeAsImageProcessingConfiguration()
@@ -862,7 +867,7 @@
 
                 defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;
 
-                if ((this._metallic !== undefined && this._metallic !== null) || (this._roughness !== undefined && this._roughness !== null)) {
+                if (this._forceMetallicWorkflow || (this._metallic !== undefined && this._metallic !== null) || (this._roughness !== undefined && this._roughness !== null)) {
                     defines.METALLICWORKFLOW = true;
                 } else {
                     defines.METALLICWORKFLOW = false;

+ 1 - 0
src/Materials/PBR/babylon.pbrMetallicRoughnessMaterial.ts

@@ -60,6 +60,7 @@
             this._useRoughnessFromMetallicTextureAlpha = false;
             this._useRoughnessFromMetallicTextureGreen = true;
             this._useMetallnessFromMetallicTextureBlue = true;
+            this._forceMetallicWorkflow = true;
         }
 
         /**