Skip to content

Commit 72245f4

Browse files
hybridherbstAdaRoseCannon
authored andcommitted
feat: add normalNode and emissiveNode support for MaterialXLoader (mrdoob#27356)
1 parent 5471265 commit 72245f4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

examples/jsm/loaders/MaterialXLoader.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,30 @@ class MaterialXNode {
588588

589589
//
590590

591+
let normalNode = null;
592+
593+
if ( inputs.normal ) normalNode = inputs.normal;
594+
595+
//
596+
597+
let emissiveNode = null;
598+
599+
if ( inputs.emission ) emissiveNode = inputs.emission;
600+
if ( inputs.emissionColor ) {
601+
602+
emissiveNode = emissiveNode ? mul( emissiveNode, inputs.emissionColor ) : emissiveNode;
603+
604+
}
605+
606+
//
607+
591608
material.colorNode = colorNode || color( 0.8, 0.8, 0.8 );
592609
material.roughnessNode = roughnessNode || float( 0.2 );
593610
material.metalnessNode = metalnessNode || float( 0 );
594611
material.clearcoatNode = clearcoatNode || float( 0 );
595612
material.clearcoatRoughnessNode = clearcoatRoughnessNode || float( 0 );
613+
if ( normalNode ) material.normalNode = normalNode;
614+
if ( emissiveNode ) material.emissiveNode = emissiveNode;
596615

597616
}
598617

0 commit comments

Comments
 (0)