Access to landscape material parameter

Hi,
I wanted to create a custom material BP for level landscape. In the material, I wanted to create a “parameter” that could change the material attribute such as base color.

How can I access the landscape’s material parameter from my 3rd person character BP. For example, if I click certain key, I wanted the 3rd person character BP to access the landscape material parameter and pass in a new value.

Thanks!

GetActorOfClass(Landscape) > Landscape Material > Create Dynamic Material Instance > Set Vector Parameter Value.
You should do the first 3 steps on Beginplay and save the dynamic material inatance as a variable to save doing it each time.

Thanks for the response, however I am not able to successfully access and update the parameter of the Landscape Material Instance runtime.

In my material BP, I created a parameter named “colourParam”:

The parameter exist in the Material Instance as shown below:

The Material Instance is used in the level landscape material:

In the Third Person BP, when I use the BP code below. When I press “E”, I am not able to change the MI of the landscape’s MI parameter, but I am able to see the print string:

Am I missing something from above?

You can set the exposed parameters directly in the material-instance-dynamic.

I would tend to use a material-parameter collection: Using Material Parameter Collections in Unreal Engine | Unreal Engine 5.2 Documentation

1 Like

Thanks!!

I just checked it out, and it works! Material Parameter Collection seems like a really useful method to use. Since it can be attached to any material, those parameters can be used to change multiple materials at the same time with a single parameter from a BP.

Thanks again!! :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.