Pārlūkot izejas kodu

Support Serialized Null Metallic Workflow

Babylon entities MUST include the ‘metallic’ and ‘roughness’ properties
in the output json. Null checks allow for presence of fields set null
to default No Metallic Workflow. Unless explicitly set to value using
babylon entities.
MackeyK24 8 gadi atpakaļ
vecāks
revīzija
2ef1359624

+ 5 - 4
Exporters/3ds Max/BabylonExport.Entities/BabylonPBRMaterial.cs

@@ -119,10 +119,10 @@ namespace BabylonExport.Entities
         public float[] emissive { get; set; }
 
         [DataMember]
-        public float roughness { get; set; }
+        public float? roughness { get; set; }
 
         [DataMember]
-        public float metallic { get; set; }
+        public float? metallic { get; set; }
 
         [DataMember]
         public bool useRoughnessFromMetallicTextureAlpha { get; set; }
@@ -172,8 +172,9 @@ namespace BabylonExport.Entities
             cameraContrast = 1.0f;
             useEmissiveAsIllumination = false;
 
-            metallic = 0.0f;
-            roughness = 0.0f;
+            // Default Null Metallic Workflow
+            metallic = null;
+            roughness = null;
             useRoughnessFromMetallicTextureAlpha = false;
             useRoughnessFromMetallicTextureGreen = false;
 

+ 1 - 1
src/Materials/babylon.pbrMaterial.ts

@@ -938,7 +938,7 @@
                 this._defines.RADIANCEOVERALPHA = true;
             }
 
-            if (this.metallic !== undefined || this.roughness !== undefined) {
+            if ((this.metallic !== undefined && this.metallic != null) || (this.roughness !== undefined && this.roughness != null)) {
                 this._defines.METALLICWORKFLOW = true;
             }