Skip to content

Commit

Permalink
use color channel as alpha for images without alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Simarilius-uk committed Mar 5, 2024
1 parent ae4ea5b commit 4cc3180
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions i_scene_cp77_gltf/material_types/meshdecal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def create(self,Data,Mat):
CurMat.links.new(mixRGB.outputs[0],CurMat.nodes['Principled BSDF'].inputs['Base Color'])

mulNode =create_node(Ns, "ShaderNodeMath", (-500,450), operation = 'MULTIPLY')
if "DiffuseAlpha" in Data:
mulNode.inputs[1].default_value = float(Data["DiffuseAlpha"])
else:
mulNode.inputs[1].default_value = 1
#if "DiffuseAlpha" in Data:
# mulNode.inputs[1].default_value = float(Data["DiffuseAlpha"])
#else:
mulNode.inputs[1].default_value = 1


dTexMapping = CurMat.nodes.new("ShaderNodeMapping")
Expand All @@ -40,7 +40,10 @@ def create(self,Data,Mat):
dImgNode = create_node(Ns,"ShaderNodeTexImage", (-800,500), label="DiffuseTexture", image=dImg)
CurMat.links.new(dTexMapping.outputs[0],dImgNode.inputs[0])
CurMat.links.new(dImgNode.outputs[0],mixRGB.inputs[2])
CurMat.links.new(dImgNode.outputs[1],mulNode.inputs[0])
if image_has_alpha(dImg):
CurMat.links.new(dImgNode.outputs[1],mulNode.inputs[0])
else:
CurMat.links.new(dImgNode.outputs[0],mulNode.inputs[0])

if "UVOffsetX" in Data:
dTexMapping.inputs[1].default_value[0] = Data["UVOffsetX"]
Expand Down

0 comments on commit 4cc3180

Please sign in to comment.