@@ -19,6 +19,9 @@ namespace Max2Babylon
1919{
2020 partial class BabylonExporter
2121 {
22+ // use as scale for GetSelfIllumColor to convert [0,PI] to [O,1]
23+ private const float selfIllumScale = ( float ) ( 1.0 / Math . PI ) ;
24+
2225 readonly List < IIGameMaterial > referencedMaterials = new List < IIGameMaterial > ( ) ;
2326 Dictionary < ClassIDWrapper , IMaxMaterialExporter > materialExporters ;
2427
@@ -208,7 +211,7 @@ private void ExportStandardMaterial(IIGameMaterial materialNode, IIPropertyConta
208211 babylonMaterial . specularPower = materialNode . MaxMaterial . GetShininess ( 0 , false ) * 256 ;
209212 babylonMaterial . emissive =
210213 isSelfIllumColor
211- ? materialNode . MaxMaterial . GetSelfIllumColor ( 0 , false ) . ToArray ( )
214+ ? materialNode . MaxMaterial . GetSelfIllumColor ( 0 , false ) . Scale ( selfIllumScale ) . ToArray ( )
212215 : materialNode . MaxMaterial . GetDiffuse ( 0 , false ) . Scale ( materialNode . MaxMaterial . GetSelfIllum ( 0 , false ) ) ; // compute the pre-multiplied emissive color
213216
214217 // If Self-Illumination color checkbox is checked
@@ -433,9 +436,10 @@ private void ExportPhysicalMaterial(IIGameMaterial materialNode, IIPropertyConta
433436 babylonMaterial . roughness = 1 - babylonMaterial . roughness ;
434437 }
435438
439+
436440 // Self illumination is computed from emission color, luminance, temperature and weight
437441 babylonMaterial . emissive = materialNode . MaxMaterial . GetSelfIllumColorOn ( 0 , false )
438- ? materialNode . MaxMaterial . GetSelfIllumColor ( 0 , false ) . ToArray ( )
442+ ? materialNode . MaxMaterial . GetSelfIllumColor ( 0 , false ) . Scale ( selfIllumScale ) . ToArray ( )
439443 : materialNode . MaxMaterial . GetDiffuse ( 0 , false ) . Scale ( materialNode . MaxMaterial . GetSelfIllum ( 0 , false ) ) ;
440444 }
441445 else
0 commit comments