@@ -163,7 +163,7 @@ def defaultShadersTree(self):
163163 )
164164
165165 ## Comp Texture
166- # Out[0] : Blend Comp Occlusion Metalic Roughness -> In[1]
166+ # Out[0] : Blend Comp Occlusion Metallic Roughness -> In[1]
167167 compTexNode = self .addNode (
168168 name = MSFS_ShaderNodes .compTex .value ,
169169 typeNode = MSFS_ShaderNodesTypes .shaderNodeTexImage .value ,
@@ -508,20 +508,6 @@ def defaultShadersTree(self):
508508 ## Links
509509 self .link (splitOccMetalRoughNode .inputs [0 ], blendCompMapNode .outputs [0 ])
510510
511- ## Occlusion Multiplier
512- # In[1] : Split Occ Metal Rough -> Out[0]
513- occlusionMulNode = self .addNode (
514- name = MSFS_ShaderNodes .occlusionMul .value ,
515- typeNode = MSFS_ShaderNodesTypes .shaderNodeMath .value ,
516- operation = "MULTIPLY" ,
517- location = (500.0 , 200.0 ),
518- width = 200.0 ,
519- frame = omrFrame
520- )
521- occlusionMulNode .inputs [0 ].default_value = 1.0
522- ## Links
523- self .link (occlusionMulNode .inputs [1 ], splitOccMetalRoughNode .outputs [0 ])
524-
525511 ## Roughness Multiplier
526512 # In[1] : Split Occ Metal Rough -> Out[1]
527513 roughnessMulNode = self .addNode (
@@ -601,12 +587,24 @@ def defaultShadersTree(self):
601587 color = (0.5 , 0.25 , 0.25 )
602588 )
603589
590+ ## Normal scale
591+ # Out[0] : Normap Map Sampler -> In[0]
592+ normalScaleNode = self .addNode (
593+ name = MSFS_ShaderNodes .normalScale .value ,
594+ typeNode = MSFS_ShaderNodesTypes .shaderNodeValue .value ,
595+ location = (- 300.0 , - 350.0 ),
596+ frame = normalFrame
597+ )
598+
599+ normalScaleNode .outputs [0 ].default_value = 1.0
600+
604601 # Fix the normal view by reversing the green channel
605602 # since blender can only render openGL normal textures
606603 RGBCurvesNode = self .addNode (
607604 name = MSFS_ShaderNodes .RGBCurves .value ,
608605 typeNode = MSFS_ShaderNodesTypes .shaderNodeRGBCurve .value ,
609- location = (- 300.0 , - 400.0 )
606+ location = (- 300.0 , - 400.0 ),
607+ frame = normalFrame
610608 )
611609 curveMapping = RGBCurvesNode .mapping .curves [1 ]
612610 curveMapping .points [0 ].location = (0.0 , 1.0 )
@@ -623,6 +621,7 @@ def defaultShadersTree(self):
623621 )
624622
625623 # Links
624+ self .link (normalMapSamplerNode .inputs [0 ], normalScaleNode .outputs [0 ])
626625 self .link (normalMapSamplerNode .inputs [1 ], normalTexNode .outputs [0 ])
627626
628627 ## Detail Normal Map Sampler
@@ -754,8 +753,8 @@ def setEmissiveColor(self, color):
754753 self .updateEmissiveLinks ()
755754
756755 def setNormalScale (self , scale ):
757- nodeNormalMapSampler = self .getNodeByName (MSFS_ShaderNodes .normalMapSampler .value )
758- nodeNormalMapSampler . inputs [0 ].default_value = scale
756+ nodeNormalScale = self .getNodeByName (MSFS_ShaderNodes .normalScale .value )
757+ nodeNormalScale . outputs [0 ].default_value = scale
759758 self .updateNormalLinks ()
760759
761760 def setDetailNormalTex (self , tex ):
@@ -845,7 +844,7 @@ def updateNormalLinks(self):
845844 nodeDetailNormalScale = self .getNodeByName (MSFS_ShaderNodes .detailNormalScale .value )
846845 nodePrincipledBSDF = self .getNodeByName (MSFS_ShaderNodes .principledBSDF .value )
847846
848- # normal
847+ # Normal
849848 self .link (nodeNormalTex .outputs [0 ], nodeRGBCurves .inputs [1 ])
850849 self .link (nodeRGBCurves .outputs [0 ], nodeNormalMapSampler .inputs [1 ])
851850 self .link (nodeNormalMapSampler .outputs [0 ], nodeBlendNormalMap .inputs [1 ])
@@ -855,10 +854,8 @@ def updateNormalLinks(self):
855854
856855 if nodeNormalTex .image and not nodeDetailNormalTex .image :
857856 self .link (nodeNormalMapSampler .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .normal .value ])
858-
859857 elif nodeNormalTex .image and nodeDetailNormalTex .image :
860858 self .link (nodeBlendNormalMap .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .normal .value ])
861-
862859 else :
863860 self .unLinkNodeInput (nodePrincipledBSDF , MSFS_PrincipledBSDFInputs .normal .value )
864861
@@ -867,7 +864,6 @@ def updateEmissiveLinks(self):
867864 nodeEmissiveScale = self .getNodeByName (MSFS_ShaderNodes .emissiveScale .value )
868865 nodeEmissiveColor = self .getNodeByName (MSFS_ShaderNodes .emissiveColor .value )
869866 nodeMulEmissive = self .getNodeByName (MSFS_ShaderNodes .emissiveMul .value )
870- # nodeMulEmissiveScale = self.getNodeByName(MSFS_ShaderNodes.emissiveMulScale.value)
871867 nodePrincipledBSDF = self .getNodeByName (MSFS_ShaderNodes .principledBSDF .value )
872868
873869 # emissive
@@ -889,7 +885,6 @@ def updateCompLinks(self):
889885 nodeSeparateComp = self .getNodeByName (MSFS_ShaderNodes .compSeparate .value )
890886 nodeMulMetallic = self .getNodeByName (MSFS_ShaderNodes .metallicMul .value )
891887 nodeMulRoughness = self .getNodeByName (MSFS_ShaderNodes .roughnessMul .value )
892- nodeMulOcclusion = self .getNodeByName (MSFS_ShaderNodes .occlusionMul .value )
893888 nodeGltfSettings = self .getNodeByName (MSFS_ShaderNodes .glTFSettings .value )
894889 nodePrincipledBSDF = self .getNodeByName (MSFS_ShaderNodes .principledBSDF .value )
895890
@@ -902,30 +897,25 @@ def updateCompLinks(self):
902897 self .link (nodeBlendCompMap .outputs [0 ], nodeSeparateComp .inputs [0 ])
903898 self .link (nodeMetallicScale .outputs [0 ], nodeMulMetallic .inputs [0 ])
904899 self .link (nodeRoughnessScale .outputs [0 ], nodeMulRoughness .inputs [0 ])
905- self .link (nodeSeparateComp .outputs [0 ], nodeMulOcclusion .inputs [1 ])
906900 self .link (nodeSeparateComp .outputs [1 ], nodeMulRoughness .inputs [1 ])
907901 self .link (nodeSeparateComp .outputs [2 ], nodeMulMetallic .inputs [1 ])
908902
909903 if not nodeCompTex .image and not nodeDetailCompTex .image :
910904 self .link (nodeRoughnessScale .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .roughness .value ])
911905 self .link (nodeMetallicScale .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .metallic .value ])
912906
913- elif nodeCompTex .image and not nodeDetailCompTex .image :
914- nodeBlendCompMap .blend_type = "ADD"
915- self .link (nodeRoughnessScale .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .roughness .value ])
907+ self .unLinkNodeInput (nodeGltfSettings , 0 )
908+ else : # nodeCompTex.image or nodeDetailCompTex.image (if we have both images or only one of them)
909+ self .link (nodeSeparateComp .outputs [0 ], nodeGltfSettings .inputs [0 ])
910+ self .link (nodeMulRoughness .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .roughness .value ])
916911 self .link (nodeMulMetallic .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .metallic .value ])
917912
918- elif not nodeCompTex .image and nodeDetailCompTex .image :
919- nodeBlendCompMap .blend_type = "ADD "
920- self . link ( nodeMulRoughness . outputs [ 0 ], nodePrincipledBSDF . inputs [ MSFS_PrincipledBSDFInputs . roughness . value ])
921- self . link ( nodeMetallicScale . outputs [ 0 ], nodePrincipledBSDF . inputs [ MSFS_PrincipledBSDFInputs . metallic . value ])
913+ if nodeCompTex .image and nodeDetailCompTex .image :
914+ nodeBlendCompMap .blend_type = "MULTIPLY "
915+ else : # we have only one of the two images
916+ nodeBlendCompMap . blend_type = "ADD"
922917
923- else :
924- nodeBlendCompMap .blend_type = "MULTIPLY"
925- self .link (nodeMulRoughness .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .roughness .value ])
926- self .link (nodeMulMetallic .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .metallic .value ])
927918
928- self .link (nodeMulOcclusion .outputs [0 ], nodeGltfSettings .inputs [0 ])
929919
930920 def setBlendMode (self , blendMode ):
931921 if blendMode == "BLEND" :
0 commit comments