Skip to content

Commit a44c4e7

Browse files
author
rt-nikowiss
authored
Fix metal-rough factor when no map but metal-rough factor not 0 (#1045)
* Fix metal-rough factor when no map but metal-rough factor not 0 * Remove redundant null check
1 parent 546d859 commit a44c4e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,8 @@ private void ExportPhysicalMaterial(IIGameMaterial materialNode, IIPropertyConta
705705
// Change the factor to zero if combining partial channel to avoid issue (in case of image compression).
706706
// ie - if no metallic map, then b MUSt be fully black. However channel of jpeg MAY not beeing fully black
707707
// cause of the compression algorithm. Keeping MetallicFactor to 1 will make visible artifact onto texture. So set to Zero instead.
708-
babylonMaterial.metallic = areTexturesAlreadyMerged || metallicTexmap != null ? 1.0f : 0.0f;
709-
babylonMaterial.roughness = areTexturesAlreadyMerged || roughnessTexmap != null ? 1.0f : 0.0f;
708+
babylonMaterial.metallic = areTexturesAlreadyMerged || metallicTexmap != null || babylonMaterial.metallic != 0 ? 1.0f : 0.0f;
709+
babylonMaterial.roughness = areTexturesAlreadyMerged || roughnessTexmap != null || babylonMaterial.roughness != 0 ? 1.0f : 0.0f;
710710
}
711711
}
712712
}
@@ -959,8 +959,8 @@ private void ExportArnoldMaterial(IIGameMaterial materialNode, IIPropertyContain
959959
// Change the factor to zero if combining partial channel to avoid issue (in case of image compression).
960960
// ie - if no metallic map, then b MUSt be fully black. However channel of jpeg MAY not beeing fully black
961961
// cause of the compression algorithm. Keeping MetallicFactor to 1 will make visible artifact onto texture. So set to Zero instead.
962-
babylonMaterial.metallic = areTexturesAlreadyMerged || metallicTexmap != null ? 1.0f : 0.0f;
963-
babylonMaterial.roughness = areTexturesAlreadyMerged || roughnessTexmap != null ? 1.0f : 0.0f;
962+
babylonMaterial.metallic = areTexturesAlreadyMerged || metallicTexmap != null || babylonMaterial.metallic != 0 ? 1.0f : 0.0f;
963+
babylonMaterial.roughness = areTexturesAlreadyMerged || roughnessTexmap != null || babylonMaterial.roughness != 0 ? 1.0f : 0.0f;
964964
}
965965
}
966966
}

0 commit comments

Comments
 (0)