Blend Opacity?

Hey all, I’m wondering if its possible to adjust the opacity of a texture when you blend it with another one?

For example, I have a rock model with a base texture and a detail texture. I want to fade the detail texture over the base so I’ve used a Blend_Overlay node however this is blending the two textures at 100% opacity. I was wondering if there’s a way to lower the opacity on one of the textures so its not so strong?

The reason I want to do this inside UE4 instead of photoshop is that the tiling on the detail texture is a lot smaller than that of the base texture.

Thanks!

Here you go!
The overlay blending mode is “neutral” at 0.5 (grey). So I used a linear interpolation to blend between the texture and 0.5 using a scalar parameter, this so you can easily tweak it inside material instances.

Good luck!

If I understand you right, then you could use a Linear Interpolation (Lerp).

Put the first texture in the A input, the second one in the B input and Alpha has to be between 0 and 1 and is the strengh between the textures.

You know, I tried to use place a LERP node but couldn’t find it in the list anymore. The only ones that came up were the LERP scratchgrime nodes. I thought maybe it was removed and replaced with something else.

Thank you.

Totally not what I told him to do, haha…anyway, I guess you want to use this for a more detailed surface if you are close to an object? If so, you could do this easily inside the material, without scalar parameters…

Lerp is short for “Linear Interpolate”, you can also place it by holding the “L” key and clicking with the left mouse button.

I know, I’m just a big fan of using parameters when someone is not sure what the end value is going to be. This way you make the material flexible and reusable. The other benefit is that you can change it dynamically, so you don’t have to recompile the shader every time.

Right, but it is more expensive than a simpler material, isn’t it?

I tried holding L and left clicking and nothing happened. Which is why I thought they removed the functionality. Very strange, I’ll try again tonight.

This material is already more expensive because of the overlay. An overlay uses a branch so it’s better not to use it.

This is the code for overlay:
return lerp((BaseBlend2),(1.0-(2.0*(1.0-Base)*(1.0-Blend))),step(0.5,Base));

The “step” is:
return x >= a;

x being the Base.

The “lerp” is:
return A+Alpha*(B-A);

So the shader is not cheap for just showing a texture. However, the scalar parameters should not have any real impact on performance, because if you are using a constant instead of a scalar you are still running the same code per pixel, just with an adjustable value. Changes of the compiler being able to optimize the constant in some way is close to 0, and even if that happens, the difference won’t be noticeable.

Try first clicking in the work space, hold L and then click again with the left mouse button.

ok, thx for the answer!