# How to control opacity gradually in masked material?

**URL:** <https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, question, Blueprint\
**Created:** [May 25, 2022, 3:50pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276 "2022-05-25T15:50:46Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 3:50pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/1 "2022-05-25T15:50:46Z")

</div>

I need to keyframe the opacity of a plane inside a blueprint which has a material that needs to be in “masked” mode, so the Opacity input is not available, only the Opacity Mask is.  
I tried several ways to have a scalar parameter as Opacity that I can bring into a level sequence, and the only way I found was this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/9/32910d2d47eae9309323732fb2f4ac4a8fd68bc4.jpeg)

I thought that was the solution, but it’s not, because when I play the sequence, it comes up suddenly at around 0.35 and not gradually. The other components that I need to fade in or out, do it gradually because their materials are set to translucent and have the opacity scalar parameters set to the opacity input.

So how can I solve this? I tried everything myself, plus searching online, and came up empty. Is there some kind of node that is like the scalar parameter but has an input and an output, like the texture A output would go to this node, which could be set to any value and keyframed in the sequencer, and the output would go to the opacity mask input? Just a thought but if anyone has any ideas, I would love to try whatever you can throw at me.

Thanks!!

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 5:22pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/2 "2022-05-25T17:22:22Z")

</div>

If you want gradual opacity change, use Translucent material. With masked, you have a certain threshold that divides visible and invisible, and by default it’s 0.3333 (you can change it in the material details, look for Opacity Mask Clip Value, but you can’t change it at runtime).

Anyway, make the material translucent, then you’ll be able to change opacity.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:09pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/3 "2022-05-25T18:09:40Z")

</div>

Yes, but that’s the main problem I have. I cannot make it translucent, because in that case I lose the alpha mask. I’m new to UE, but it seems that even if the original file has an alpha channel, UE needs to have the masked mode enabled to allow the alpha channel, otherwise the effect I applied to the emission input applies to the whole thing, not just the pixels that have content.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:14pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/4 "2022-05-25T18:14:24Z")

</div>

You can still use alpha in Translucent, just multiply your emissive value by this alpha and you’ll have no emission where alpha is 0.  
Moreover, you can use an IF node with the alpha to have any kind of data for alpha 0 and alpha 1.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:22pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/5 "2022-05-25T18:22:47Z")

</div>

You mean like this?:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/c/cdc23fcf040a236b42a7bb32714b7ad334dacada.jpeg)

What that gives me is the material without alpha. I still see the graphic, but the background is not transparent, it’s white.  
As for the IF node, I loaded it, but I don’t have a clue how it works, although I will look it up.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:28pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/6 "2022-05-25T18:28:41Z")

</div>

IDK what your alpha layer is, but judging from your image, you can do this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/7/b47c04665ed06bc2fe1f8c7439ee3a4d99f1441c.jpeg)

And use it as mask instead of Alpha

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:38pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/7 "2022-05-25T18:38:07Z")

</div>

OK, but then where do I plug the output of the IF node? If I connect it to the base color, it makes the whole thing glow. If I connect it to the opacity, I see only the busy pixels glow, but then I can’t connect the opacity scalar parameter to it. And the other inputs I can connect it to, I don’t think that would work either.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:39pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/8 "2022-05-25T18:39:20Z")

</div>

Multiply your emission by this mask.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:41pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/9 "2022-05-25T18:41:09Z")

</div>

Sorry, what mask?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:44pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/10 "2022-05-25T18:44:44Z")

</div>

The thing you get from IF. It’s black and white, you can use it as a mask instead of alpha of your image.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:46pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/11 "2022-05-25T18:46:10Z")

</div>

OK, so you mean something like this?

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

That still doesn’t give me the transparency from the original image, unless I’m missing something?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:47pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/12 "2022-05-25T18:47:40Z")

</div>

Connect IF to Opacity, and it will.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 6:51pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/13 "2022-05-25T18:51:28Z")

</div>

Right, but that’s what I was saying earlier. If I send the If output to the opacity node, sure, I get the transparency, but I lose the opacity input to plug in the scalar parameter to keyframe opacity in the sequencer. That’s the main point, if I use translucent mode, it has to be in a way that gives me the transparency of the texture without using the Opacity input.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 25, 2022, 6:53pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/14 "2022-05-25T18:53:02Z")

</div>

Now you can multiply the If result by your scalar parameter, and changing this parameter will change the overall opacity.

---

<div class="post-metadata">

**Author:** ![sebalv70](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebalv70](https://forums.unrealengine.com/u/sebalv70)\
**Post date:** [May 25, 2022, 7:00pm UTC](https://forums.unrealengine.com/t/how-to-control-opacity-gradually-in-masked-material/566276/15 "2022-05-25T19:00:40Z")

</div>

Thank you, that worked! This would be the whole thing, if anybody else comes across this problem:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/0/150c02df4a9b903561a2b58723e94fb169a1b76f.jpeg)

Although, in the sequencer, you have to set the starting keyframe to weighted tangent and extend it quite a lot to make the material appear gradually. For some reason it shows up too quickly otherwise.

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