How to paint a part of one texture with another texture?

Hello! I want to paint a part of one texture with another in a material. Like, for example, Paradox Interactive does on their engine for countries flags. I know, that they don’t use UE 4, but I am sure, that is it possible in UE 4 two. I am not going to use their textures, that is just an example of what I want to achieve with my own. I just don’t know, where else and for what purpose these technology may be used.

Example 1. (Victoria 2.)

As you may see here, white half-transpanent part of a round is painted with nation’s flag. How can I do the same, if I have a texture, part of what I want to paint, and a texture, which I want to use as a paint. What shall I do?

  1. Inside a material (which are shaders in Unreal) you can use a lerp-node (linearily interpolate) between various values using an alpha value. If you had an object like a billboard or a flag or something else, you would have two textures - the base, and the thing you would want to include. You would lerp them using either a black and white texture as a mask, or an alpha (transparency) channel of one or the other.

  2. Slate widgets are Unreal’s native way of making and combining UI elements which can consist of images, materials and text. To replicate your picture, you would quite simply just overlay the flag-image on top.

You have two choices;

  1. material with a mask texture (or an alpha channel, or math) that lerps (transitions) between sampled textures (this option doesn’t make sense for ui)

  2. have elements overlayed in slate widgets

In both cases you can dynamically switch textures using blueprints

Can you, please, explain both in details?