Download

Outline mask texture?

I have a mask texture like this for example.

What I want to do is apply it to a plane with a material, but in the material, color in the mask (white parts) in light red and the edge of the mask (where the white meets the black) in a darker red, with some sort of border thickness, so the result looks something like this.

I know how to color in the white part in light red (or pink), by just mutltiplying the mask texture by a pink color. But does anyone have any idea how I could create the darker red border?

Anyone got any ideas?

You can make separate texture mask for the outline, that would be the simplest option.

Second option, make the outline in your material. That requires sampling the texture several times:

You can also increase the outline ‘precision’ by sampling the texture 8 times (with additional offsets like (1,1), (-1,-1), etc.).

I will give that a try. The mask texture is generated at runtime using a render target, so I need a dynamic approach and it looks like your solution is what I was looking for. Thank you.

Absolute beast… was literally trying to run this logic for like 6 hours until i decided to look for help… got pretty close lol. thanks bro

1 Like