소스 검색

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