Alpha blending textures in material

I’ve got a texture with an alpha channel in ue4 and I would like to alpha blend that texture with a base color similar to how an alpha masked texture works in photoshop. I can’t find any node in the material editor that does this. How can I achieve this?

I think you’re searching for the lerp (linear interpolate) node.
connect your texture color output to the second input of the lerp node and the alpha channel of your texture to the alpha input on the lerp node.
Then connect your base color to the first input of the node.

I think that is what you where searching for, am I right?

The lerp node was the first thing I tried. It didn’t give me the same result as photoshop and I spend hours trying to understand what’s going on. It turns out the problem is the way photoshop exports alpha channels and has nothing to do with ue4. The lerp node is exactly the right node for alpha blending. I’ll explain with the help of a few screenshots:

Here’s my basic setup in photoshop. There’s a red base color layer, a dirt layer with alpha channel generated with dDo with (normal blend mode) and an ambient occlusion map (multiply blend mode). This is a view of the dirt layer. I exported all layers individually and also saved a texture with all layers merged. Here’s the same setup in ue4, currently connected to the merged texture. The goal is to get that same look but being able to adjust the base color in the material. When connecting the network blending the individual textures the result is very different. I’m still not quite sure why photoshop adds a white background and multiplies it with all translucent pixels when exporting the tga. I couldn’t get this issue resolved in photoshop. Opening the psd in gimp and exporting the dirt layer as tga works fine though. So that’s my workaround at the moment. Another related issue I encountered trying to reproduce the look of the texture in ue4 was the color profile used in photoshop. The default color profile seems to be a different one than used in gimp or ue4, which also took me a while to figure out and contributed to the colors not matching. Truth be told, I don’t like photoshop in general or adobe’s subscription policy and I’d rather be using gimp but dDo is just too powerful to not use it. UE4 and epic on the other hand are awsome. :slight_smile:

So in short, yes you’re right NaMJaG.

I hope my little explanation will be useful to someone else.

In Photoshop saving a tga with alpha is not only saving the Image. tga is able to keep the information in the 100% alpha areas of the image (not like png by default). So you have to add a alpha channel in photoshop and save it as an 32bit tga to have the right alpha information. If you don’t want the white areas simply fill these areas with an average color or you add some layers with a blured version of the image below to have a proper background.
This is very useful if you want to use the alpha channel of the diffuse or normal for a height map, ao, mask or something like that without losing color information in the other channels.

good luck and hf :slight_smile:

Thank you for recommmend the LERP node, it helped me!