# Material Blend Layer's Scalar Parameter at runtime?

**URL:** <https://forums.unrealengine.com/t/material-blend-layers-scalar-parameter-at-runtime/865416>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [April 6, 2023, 8:59pm UTC](https://forums.unrealengine.com/t/material-blend-layers-scalar-parameter-at-runtime/865416 "2023-04-06T20:59:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![basic\_writing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@basic\_writing](https://forums.unrealengine.com/u/basic_writing)\
**Post date:** [April 6, 2023, 8:59pm UTC](https://forums.unrealengine.com/t/material-blend-layers-scalar-parameter-at-runtime/865416/1 "2023-04-06T20:59:49Z")

</div>

Hello all!

After another week of banging my head against a wall, I thought I saw the light until…  
I am trying to trigger switch of material according to a float variable (var\_float) for a project of mine.  
The constraint is that there are 5 materials to switch between depending on var\_float.

I managed to set the logic for that.

But blending between one material to another proves more complex than I could imagine.  
I thought I found a solution in using a Material Instance with Blend Layer as simple Alpha to switch between my 5 material Layers.  
The idea is to use the Blend Layer scalar parameter for the alpha to display or not the texture if var\_float is within a defined range.

That all works: in the Material Instance, I can toggle between 1 and 0 the scalar parameters of the 5 Blend Layers I have for my 5 Materials and they display the way I want.

But now comes the issue: var\_float changes on minute basis, so evolves at runtime.  
And I want the material to blend and change accordingly.  
When I try to get my Blend Layers’ scalar parameters in the Level\_BP to set them up with the Create Dynamic Material Instance, my material doesn’t update or change.  
Though, I can ‘play’ the project and toggle the Blend Layers’ scalar parameters manually and see the change…

Likely, there is something that I am not properly connecting.  
But I also worry, after reading a post from another person here who had a similar (unsolved) issue: can Blend Layer’s scalar parameters be changed at runtime?

If not, does anyone has a possible solution to achieve a blend between multiple materials?

Here is the logic for the display of my material depending on var\_float:  
mat\_1 if var\_float = in range (-7.5 to -4.5)  
mat\_2 if var\_float = in range (-6.75 to -0.75)  
mat\_3 if var\_float = in range (-3 to 3)  
mat\_4 if var\_float = in range (0.75 to 6.75)  
mat\_5 if var\_float = in range (4.5 to 7.5)

 ![InkedMat_mat_instance](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/6/4/7649e49b06f8eae12ae1bb8affa76f0f717d6101.jpeg)  
The scalar parameters from Blend Layers - that works just fine

 ![Mat_levelbp_scalar parameter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/5/fb595b854167930d18a18f21e91fdb68f3d13607.jpeg)  
Level\_BP, setting up var\_float to modify the Blend Layer’s Scalar parameters at runtime

---

<div class="post-metadata">

**Author:** ![basic\_writing](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@basic\_writing](https://forums.unrealengine.com/u/basic_writing)\
**Post date:** [April 19, 2023, 9:51am UTC](https://forums.unrealengine.com/t/material-blend-layers-scalar-parameter-at-runtime/865416/2 "2023-04-19T09:51:14Z")

</div>

After more investigation on this matter, I gathered that one cannot modify Material Blend Layer’s scalar parameter from BP.  
A shame, that would have been the ideal solution for what I want to achieve.

Although, I looked into more option and found that using UDIM offers an elegant solution to switch between multiple materials.

My only problem now is to find a way to make a smooth transition between these materials.

It is easy to blend between two material with the blend node.  
But in this case, I have 5 materials, and depending on the float\_range var that calls the material, I want to be able to transition from mat\_1 to mat\_4 or mat\_5 to mat\_3 for example.

I guess one would use the Timeline node in the BP to achieve such thing, although, it isn’t working so well here, as it always starts from a value of 0 (so mat\_1 in this case).  
Or is there a way that key values can be changed at runtime for the Timeline node?  
Any idea on how to organize such a transition?
