Transparent image like a decal on mesh with principled BSDF shader

I have done this before, but that was before the principled BSDF shader existed. Now I’m trying to do a similar node setup with the principled BSDF shader instead of the diffuse BSDF shader, but the result is not 100% perfect! The background of the mesh with the transparent decal image, differ slightly compared to the surrounding mesh. I want the background around the decal to be fully transparent and look just like the nearby meshes.
The principled BSDF shader to the left in the image below has the green color for that background and that is the green color I also use on the rest of the object with the same settings.
Is there a better way to achieve this with a better node setup or just adjust my node setup in some way? I have tried to adjust the value of the mix shader, but without any improvement.


Do you need to mix the shaders, or could you just mix the color feeding into one shader?

The less shaders in a node tree, the better. At least as far as rendering efficiency goes.

Thanks for your answer! How do I mix the color feeding into one shader?

A color, mix rgb node. Yes, if both materials have the same nodes and olny the color changes then mix the color mix rgb node with the alpha as the factor, and then feed that into a single principled bsdf color input.

Thank you for your explanation, but I still have the same problem, see image. I hope my node setup is as you explained? Any other ideas how to solve this?



Are you sure the transparent part of your decal really has an alpha value of 0.0?
Please upload the PNG file somewhere for us to have a look.

This is the image:


I made it in Inkscape, but I have also tested with GIMP.

The node setup is correct, is it possible that you are only using that material on the single face, and that the rest of the object has a different material? Can you delete all but a chunk of your object and post a blend?

That is correct, I only use this material on a single face and the rest of the object has a different material. Is there a better way to do this? Can’t send any blend file now since I’m not at the working computer. Perhaps my answer still helps to solve this problem? I have also tested to make this face a single object, but whitout any improvement when I render the image.

You can do it both ways, although a single material is, more common and simple. You basically mark seams around the area where the decal goes, unwrap the whole thing, and then shrink down (or weld) the other uvs into a corner.

The 2 material way you are doing it now will also work, but your second outside material must match exactly the material in the inside face. Best to select the principled shader and ctrl c copy and then ctrl v paste into the other material in the node editor.