فهرست منبع

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 سال پیش
والد
کامیت
2ef1359624
2فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 5 4
      Exporters/3ds Max/BabylonExport.Entities/BabylonPBRMaterial.cs
  2. 1 1
      src/Materials/babylon.pbrMaterial.ts

+ 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;
             }