Users browsing this thread: 1 Guest(s)
How To Correctly Display Textures With Transparency In Blender
#3
You don't need the Mix/TransparentBSDF stuff anymore, you just need to connect the texture Alpha to the PrincipledBSDF Alpha (and set the Blend Mode).

[Image: 2U7Luju.png]

Here's a script you can try that will do this automatically for all materials. Put it in the text editor and hit the Run button.

Code:
# Tested with Blender 2.90
import bpy
for mat in bpy.data.materials:
    if not mat.use_nodes: continue
    for n in mat.node_tree.nodes:
        if n.type == 'BSDF_PRINCIPLED': break
    else: continue
    if n.inputs["Alpha"].links: continue  # skip if already has linked Alpha
    soc = n.inputs["Base Color"]
    if not soc.links: continue
    if soc.links[0].from_socket.name != "Color": continue
    tex = soc.links[0].from_node
    if tex.type != 'TEX_IMAGE': continue
    if not tex.image: continue
    if tex.image.depth != 32: continue  # guess if image has alpha channel
    mat.node_tree.links.new(tex.outputs["Alpha"], n.inputs["Alpha"])
    mat.blend_method = 'HASHED'
Reply
Thanked by: zadayaz


Messages In This Thread
RE: How To Correctly Display Textures With Transparency In Blender - by scurest - 08-29-2020, 07:58 PM

Forum Jump: