Page MenuHome

obj file import automatically connects the colour output of all png's into the principled's alpha input, needs to be the alpha output.
Closed, ResolvedPublic


System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 452.06

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-09-09 00:05, hash: rBb8840c105a4e
Worked: (newest version of Blender that worked as expected)

Short description of error

obj file import automatically creates a second image texture node if the material has a .png file assigned, and then connects the colour output of the second image node into the principled's alpha input, needs to be the alpha output which connects to the principled alpha input.

Import file and examine material of imported object

Event Timeline

Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Tue, Sep 15, 2:40 PM

Please upload example file.

Is source of .obj file .blend file? if so, please upload .blend file

Hi Richard, file below. Created in 3ds max, but that doesnt make any difference as the same issue happens in all fbx files regardless application used to generate file. To confirm this once you've imported the file, select the model, go to the shader editor, delete the image texture that's conected to the alpha, export from blender, then reimport. The same bug will arise.

ps, obj doesnt do anything with alpha if the texutre is .png. Ideally if the base colour has a .png file, then the alpha output should lead to the principled alpha input. this will always make sure that if there is an alpha channel it will be used, and if there isn't it won't make a difference.

Richard Antalik (ISS) changed the task status from Needs Information from User to Confirmed.Tue, Sep 15, 6:49 PM
Richard Antalik (ISS) updated the task description. (Show Details)

@Richard Antalik (ISS) this is add-on stuff, not DATA/IO area!

@michael campbell (3di) looks like you are confusing the formats here, you are talking about OBJ but provides an FBX?

In any case, am not sure there is actually a bug here, sounds more like known limitations (translating a static shading like in FBX or OBJ, to a nodal material is always tricky, exact match is seldom possible).

Bastien Montagne (mont29) changed the task status from Confirmed to Needs Information from User.Wed, Sep 16, 12:01 PM

It’s easy to code, I’ve already written it. Just need to assign the base couloir textures alpha out to the principled alpha in if the format is .png.

Yep, it’s the fbx Importer that gets it wrong, the obj Importer doesn’t bother trying :)

Easier to do in the importer, but here's how I do it after the fact.

import bpy

mats =

for mat in mats:
    principled = mat.node_tree.nodes["Principled BSDF"]
    socket = principled.inputs[18] # alpha input
    links = mat.node_tree.links

    #generate array of links that have a textures colour output plugged into a principled's alpha
    tex_ps_links = [l for l in links 
        if l.from_node.type == 'TEX_IMAGE' 
        and == "Color"
        and l.to_node.type == 'BSDF_PRINCIPLED'
        and == "Alpha"]

    for l in tex_ps_links:
        # print tex node image
        texnode = l.from_node
         #create new link[18], texnode.outputs['Alpha'])

regardless though, it's definitely a bug, otherwise every imported material that uses a .png will render semi transparent unless the user goes through each material and swaps over the sockets.

the importer is presumably already checking if the imported diffuse is using a .png texture rather than a .jpg etc, because it only creates the additional image texture node in the case of png. So in the bit of code that creates the second image texture node, it must also be creating the link between the colour socket and the principled alpha socket. So it would appear to be just an error in the line of code that creates the link:

this is being done:[18], texnode.outputs['Color'])

instead of:[18], texnode.outputs['Alpha'])

I can't see much point in creating a second image texture node though, why not just connect from the original's alpha to the principled's alpha?