@@ -443,6 +443,54 @@ def defaultShadersTree(self):
443443 color = (0.1 , 0.4 , 0.6 )
444444 )
445445
446+ ## Multiply Detail OMR
447+ # In[0] : Detail OMR texture
448+ # Out[0] : Substract Detail OMR
449+ multiplyDetailOMR = self .addNode (
450+ name = MSFS_ShaderNodes .detailOMRMul .value ,
451+ typeNode = MSFS_ShaderNodesTypes .shaderNodeVectorMath .value ,
452+ operation = "MULTIPLY" ,
453+ location = (- 500.0 , 200.0 ),
454+ width = 200.0 ,
455+ frame = omrFrame
456+ )
457+ multiplyDetailOMR .inputs [1 ].default_value = (2.0 , 2.0 , 2.0 )
458+
459+ ## Links
460+ self .link (detailCompTexNode .outputs [0 ], multiplyDetailOMR .inputs [0 ])
461+
462+ ## Substract Detail OMR
463+ # In[0] : Multiply Detail OMR
464+ # Out[0] : Clamp Detail OMR
465+ subtractDetailOMR = self .addNode (
466+ name = MSFS_ShaderNodes .detailOMRSubtract .value ,
467+ typeNode = MSFS_ShaderNodesTypes .shaderNodeVectorMath .value ,
468+ operation = "SUBTRACT" ,
469+ location = (- 500.0 , 150.0 ),
470+ width = 200.0 ,
471+ frame = omrFrame
472+ )
473+ subtractDetailOMR .inputs [1 ].default_value = (1.0 , 1.0 , 1.0 )
474+
475+ ## Links
476+ self .link (multiplyDetailOMR .outputs [0 ], subtractDetailOMR .inputs [0 ])
477+
478+ ## Map to clamp detail OMR
479+ # In[0] : Substract Detail OMR
480+ # Out[0] : Add Detail comp
481+ clampDetailOMR = self .addNode (
482+ name = MSFS_ShaderNodes .detailOMRClamp .value ,
483+ typeNode = MSFS_ShaderNodesTypes .shaderNodeMapRange .value ,
484+ location = (- 500.0 , 100.0 ),
485+ width = 200.0 ,
486+ frame = omrFrame
487+ )
488+ clampDetailOMR .data_type = "FLOAT_VECTOR"
489+ clampDetailOMR .interpolation_type = "LINEAR"
490+
491+ ## Links
492+ self .link (subtractDetailOMR .outputs [0 ], clampDetailOMR .inputs [6 ]) ## input[6] == "Vector"
493+
446494 ## Metallic scale
447495 # Out[0] : Metallic Multiplier -> In[0]
448496 # Out[0] : PrincipledBSDF -> In["Metallic"]
@@ -464,24 +512,22 @@ def defaultShadersTree(self):
464512 )
465513
466514 ## Blend Detail Operations (OccMetalRough)
467- # Detail comp operators
515+ # Add Detail comp
468516 # In[0] : Vertex Color -> Out[1]
469517 # In[1] : Comp Texture -> Out[0]
470518 # In[2] : Detail Comp Texture -> Out[0]
471519 blendCompMapNode = self .addNode (
472520 name = MSFS_ShaderNodes .blendCompMap .value ,
473- typeNode = MSFS_ShaderNodesTypes .shaderNodeMixRGB .value ,
474- blend_type = "MULTIPLY " ,
521+ typeNode = MSFS_ShaderNodesTypes .shaderNodeVectorMath .value ,
522+ operation = "ADD " ,
475523 location = (- 150.0 , 200.0 ),
476524 width = 300.0 ,
477525 frame = omrFrame
478- )
479- blendCompMapNode .inputs [0 ].default_value = 1.0
526+ )
480527
481528 ## Links
482- self .link (blendCompMapNode .inputs [0 ], vertexColorNode .outputs [1 ])
483- self .link (blendCompMapNode .inputs [1 ], compTexNode .outputs [0 ])
484- self .link (blendCompMapNode .inputs [2 ], detailCompTexNode .outputs [0 ])
529+ self .link (compTexNode .outputs [0 ], blendCompMapNode .inputs [0 ])
530+ self .link (clampDetailOMR .outputs [1 ], blendCompMapNode .inputs [1 ])
485531
486532 ## Split Occlusion Metallic Roughness
487533 # In[0] : Blend Comp Map -> Out[0]
@@ -554,7 +600,7 @@ def defaultShadersTree(self):
554600 name = MSFS_ShaderNodes .emissiveMul .value ,
555601 typeNode = MSFS_ShaderNodesTypes .shaderNodeMixRGB .value ,
556602 blend_type = "MULTIPLY" ,
557- location = (200 .0 , 0 .0 ),
603+ location = (250 .0 , - 50 .0 ),
558604 frame = emissiveFrame
559605 )
560606
@@ -868,11 +914,14 @@ def updateEmissiveLinks(self):
868914
869915 # emissive
870916 if nodeEmissiveTex .image :
871- self .link (nodeEmissiveColor .outputs [0 ], nodeMulEmissive .inputs [0 ])
872- self .link (nodeEmissiveTex .outputs [0 ], nodeMulEmissive .inputs [1 ])
917+ self .link (nodeEmissiveScale .outputs [0 ], nodeMulEmissive .inputs [0 ])
918+ self .link (nodeEmissiveColor .outputs [0 ], nodeMulEmissive .inputs [1 ])
919+ self .link (nodeEmissiveTex .outputs [0 ], nodeMulEmissive .inputs [2 ])
873920 self .link (nodeMulEmissive .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .emission .value ])
874921 else :
875922 self .link (nodeEmissiveColor .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .emission .value ])
923+ self .unLinkNodeInput (nodeMulEmissive , 0 )
924+ self .unLinkNodeInput (nodeMulEmissive , 1 )
876925
877926 self .link (nodeEmissiveScale .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .emissionStrength .value ])
878927
@@ -888,11 +937,6 @@ def updateCompLinks(self):
888937 nodeGltfSettings = self .getNodeByName (MSFS_ShaderNodes .glTFSettings .value )
889938 nodePrincipledBSDF = self .getNodeByName (MSFS_ShaderNodes .principledBSDF .value )
890939
891- # blend comp
892- # !!!! input orders matters for the exporter here
893- self .link (nodeCompTex .outputs [0 ], nodeBlendCompMap .inputs [1 ])
894- self .link (nodeDetailCompTex .outputs [0 ], nodeBlendCompMap .inputs [2 ])
895-
896940 # occlMetalRough
897941 self .link (nodeBlendCompMap .outputs [0 ], nodeSeparateComp .inputs [0 ])
898942 self .link (nodeMetallicScale .outputs [0 ], nodeMulMetallic .inputs [0 ])
@@ -910,13 +954,6 @@ def updateCompLinks(self):
910954 self .link (nodeMulRoughness .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .roughness .value ])
911955 self .link (nodeMulMetallic .outputs [0 ], nodePrincipledBSDF .inputs [MSFS_PrincipledBSDFInputs .metallic .value ])
912956
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"
917-
918-
919-
920957 def setBlendMode (self , blendMode ):
921958 if blendMode == "BLEND" :
922959 self .makeAlphaBlend ()
@@ -930,17 +967,14 @@ def setBlendMode(self, blendMode):
930967 def toggleVertexBlendMapMask (self , useVertex = True ):
931968 nodeVertexColor = self .getNodeByName (MSFS_ShaderNodes .vertexColor .value )
932969 nodeBlendColorMap = self .getNodeByName (MSFS_ShaderNodes .blendColorMap .value )
933- nodeBlendCompMap = self .getNodeByName (MSFS_ShaderNodes .blendCompMap .value )
934970 nodeBlendNormalMap = self .getNodeByName (MSFS_ShaderNodes .blendNormalMap .value )
935971 nodeBlendMaskTex = self .getNodeByName (MSFS_ShaderNodes .blendMaskTex .value )
936972 # vertexcolor mask
937973 if useVertex :
938974 self .link (nodeVertexColor .outputs [1 ], nodeBlendColorMap .inputs [0 ])
939- self .link (nodeVertexColor .outputs [1 ], nodeBlendCompMap .inputs [0 ])
940975 self .link (nodeVertexColor .outputs [1 ], nodeBlendNormalMap .inputs [0 ])
941976 else :
942977 self .link (nodeBlendMaskTex .outputs [0 ], nodeBlendColorMap .inputs [0 ])
943- self .link (nodeBlendMaskTex .outputs [0 ], nodeBlendCompMap .inputs [0 ])
944978 self .link (nodeBlendMaskTex .outputs [0 ], nodeBlendNormalMap .inputs [0 ])
945979
946980 def makeOpaque (self ):
0 commit comments