Layered materials in C++ - with opacity

Hi, I simply want to overlay two materials from my actor class - to be more detailled to add a yellow line to split my lanes on a procedurally generated street. So I have a basic street material and a lane splitter material.

Currently I add both materials via:

mesh->SetMaterial(0, this->material);
mesh->SetMaterial(1, this->splitterMaterial);

But that results only in the second material displayed on my mesh even if the texture of the splitterMaterial contains an alpha channel. Is there a good way to add only the non transparent part of the second material to the below material?

Hi Omnicypher, it is just a simple texture sample connected to a material’s base color. I don’t mix both materials and I’d like to do it in my code not in the visual editor since I want to keep it dynamic.

could you show your material graph?

Show your material.

Only connecting the base colour will not add transparency.

This is it: