Use principled shader

This commit is contained in:
GreenDimond 2019-07-08 13:51:26 -07:00
parent a507e93f73
commit b93d6f6ad0

View File

@ -30,27 +30,28 @@ for mat in bpy.data.materials:
map = nodes.new("ShaderNodeMapping")
map.location = -400, 0
# Create diffuse shader
diff = nodes.new("ShaderNodeBsdfDiffuse")
diff.location = 200, 0
# Create principled shader
prin = nodes.new("ShaderNodeBsdfPrincipled")
prin.location = 200, 0
prin.inputs["Specular"].default_value = 0
# Create transparent shader
trans = nodes.new("ShaderNodeBsdfTransparent")
trans.location = 200, -150
trans.location = 400, -150
# Create mix shader
mix = nodes.new("ShaderNodeMixShader")
mix.location = 400, 0
mix.location = 600, 0
# Create output
out = nodes.new("ShaderNodeOutputMaterial")
out.location = 600, 0
out.location = 800, 0
# Link everything
links.new(coord.outputs[2], map.inputs[0]) # Coord > Map
links.new(map.outputs[0], tex.inputs[0]) # Map > Texture
links.new(tex.outputs[0], diff.inputs[0]) # Texture > Diffuse
links.new(diff.outputs[0], mix.inputs[2]) # Diffuse > Mix
links.new(tex.outputs[0], prin.inputs[0]) # Texture > Principled
links.new(prin.outputs[0], mix.inputs[2]) # Principled > Mix
links.new(trans.outputs[0], mix.inputs[1]) # Transparent > Mix
links.new(tex.outputs[1], mix.inputs[0]) # Texture alpha > Mix factor