# How to blend materials in horizontal direction

**URL:** <https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [September 29, 2021, 10:59am UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331 "2021-09-29T10:59:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![GG\_naja](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gg_naja/32/1109848_2.png) [@GG\_naja](https://forums.unrealengine.com/u/GG_naja)\
**Post date:** [September 29, 2021, 10:59am UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/1 "2021-09-29T10:59:24Z")

</div>

Hi, I managed to block shader from light direction in anime style. And I try to blend 2 materials together in horizontal direction like in genshin impact. I searched all over google but no luck. Is there any way to do that? I want to do something like this.

This is my genshin impact model now:

![349567-ezgifcom-gif-maker.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/9/4f9656eed5fc56e426b02a397cfe088223367579.gif)

And this is what I want.

This is my simple node that use direction to change material for each degree:

 ![349568-temp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/c/d/acd429306d75a2d53e388b80cead640b9a25b583.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 29, 2021, 1:07pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/2 "2021-09-29T13:07:09Z")

</div>

You’re switching when the angle reaches a certain amount, which is what we see. You need to lerp between the two values depending on angle of the camera ( I guess, if you’re not using light ).

---

<div class="post-metadata">

**Author:** ![GG\_naja](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gg_naja/32/1109848_2.png) [@GG\_naja](https://forums.unrealengine.com/u/GG_naja)\
**Post date:** [September 29, 2021, 1:21pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/3 "2021-09-29T13:21:38Z")

</div>

Hi, thank you. So which values should I lerp here? Sorry I’m very new to material. I’m using light for angle here.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 29, 2021, 1:26pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/4 "2021-09-29T13:26:24Z")

</div>

It’s a bit unclear to me what’s happening. It all hinges on the direction variable? What values can that variable take?

Then you seem to have a normal face and a slightly darker face, and you want to fade between them based on the direction?

Is that right?

---

<div class="post-metadata">

**Author:** ![GG\_naja](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gg_naja/32/1109848_2.png) [@GG\_naja](https://forums.unrealengine.com/u/GG_naja)\
**Post date:** [September 29, 2021, 2:51pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/5 "2021-09-29T14:51:51Z")

</div>

Hi! Direction parameter come from actorBP that get value direction from Light Source in level. So now somehow I can manage to do transition but I don’t want this. From picture below, I want to it to fade in arrow direction instead of fade out entire material. Is this possible?

![349603-ezgifcom-gif-maker.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/1/ff1cfd5216ebb98a884e48f94b5d6d58a23a8cc7.gif)

---

<div class="post-metadata">

**Author:** ![GG\_naja](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gg_naja/32/1109848_2.png) [@GG\_naja](https://forums.unrealengine.com/u/GG_naja)\
**Post date:** [September 29, 2021, 3:18pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/6 "2021-09-29T15:18:06Z")

</div>

And yes, I want it to fade base on light direction. Thank you very much.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 29, 2021, 4:19pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/7 "2021-09-29T16:19:36Z")

</div>

Something along the lines of ( this will not work out of the box ):

 ![349605-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/c/9ec95fd9473bd40dcbe7d0375cd8f9d6c695087e.jpeg)

Sorry, didn’t have much time earlier.

What I’m saying is, just use the lerps, don’t use IFs.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 29, 2021, 6:52pm UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/8 "2021-09-29T18:52:37Z")

</div>

Like this:

 ![349633-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/3/3b31a67f62654bb86dbbc1a683f4c81ff2348a17.jpeg)

![349634-lerp.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/0/0a0dd5197d5c6df561606fc3767a914f2a4bbe11.gif)

Much easier if you map the angles to 0-1 in the character BP.

---

<div class="post-metadata">

**Author:** ![GG\_naja](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gg_naja/32/1109848_2.png) [@GG\_naja](https://forums.unrealengine.com/u/GG_naja)\
**Post date:** [September 30, 2021, 3:50am UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/9 "2021-09-30T03:50:20Z")

</div>

Hi! Thank you very much for your help! I did it but the result is not as I expected. However I tried remap value range node around so I solved this by using it.

 ![349646-temp.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/8/66841a7aa61367e905c0340be2db0d35a8fc5e0a.png)

Here is the result I want. I blend 2 alpha together by node above. Thank you again!

![349647-ezgifcom-gif-maker.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/5/6/4565218e7d320f8e42402379ba944c9e8ee9c445.gif)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 30, 2021, 7:03am UTC](https://forums.unrealengine.com/t/how-to-blend-materials-in-horizontal-direction/489331/10 "2021-09-30T07:03:27Z")

</div>

Excellent 🙂
