# How to create a material that mixes two colors like a gradient

**URL:** <https://forums.unrealengine.com/t/how-to-create-a-material-that-mixes-two-colors-like-a-gradient/614605>\
**Category:** Asset Creation\
**Tags:** UE4-27\
**Created:** [July 26, 2022, 11:46am UTC](https://forums.unrealengine.com/t/how-to-create-a-material-that-mixes-two-colors-like-a-gradient/614605 "2022-07-26T11:46:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mendes](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mendes/32/597682_2.png) [@Mendes](https://forums.unrealengine.com/u/Mendes)\
**Post date:** [July 26, 2022, 11:46am UTC](https://forums.unrealengine.com/t/how-to-create-a-material-that-mixes-two-colors-like-a-gradient/614605/1 "2022-07-26T11:46:56Z")

</div>

How to do this guys? Like gradient:

What i have:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/e/5/1e5b790915325e3601ba5987ea5b3a0c4e5bc6ba.jpeg)

What i Want:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/e/e9e010de5f0f3997fac58dfa5af2f30574c83785.png)

---

<div class="post-metadata">

**Author:** ![JustA3DMan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/justa3dman/32/1186021_2.png) [@JustA3DMan](https://forums.unrealengine.com/u/JustA3DMan)\
**Post date:** [July 26, 2022, 5:25pm UTC](https://forums.unrealengine.com/t/how-to-create-a-material-that-mixes-two-colors-like-a-gradient/614605/2 "2022-07-26T17:25:42Z")

</div>

Could you not use a multiply node in some capacity here with a grayscale texture… maybe?? (I’m new to UE.)

---

<div class="post-metadata">

**Author:** ![Frenetic](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/frenetic/32/1142542_2.png) [@Frenetic](https://forums.unrealengine.com/u/Frenetic)\
**Post date:** [July 26, 2022, 5:40pm UTC](https://forums.unrealengine.com/t/how-to-create-a-material-that-mixes-two-colors-like-a-gradient/614605/3 "2022-07-26T17:40:58Z")

</div>

LERP between the colors. The alpha is whatever math you use to make the gradient.

You will still have to come up with a black/white mask to tell the shader where to apply one color or the other, that doesn’t just come out by itself.

You can use this to create an object mask, just be sure to pick a channel in the component-mask for whatever axis you want to use. This is only an example you can use whatever logic/maths you want to ultimately drive that alpha/mask. As well, this technique of using a mask to mix/LERP things is pretty much ‘the trick’ to making advanced materials work:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/d/f/edfe2f3db2361bb4797d6895a6eed5cc757a27d8.jpeg)
