How to apply Dynamic Material Instance to Foliage?

I’m working on a dynamic seasonal color variation for foliage. My goal was to make material parameter of foliage instanced meshes (e.g., color of the leaves) change on a go depending on the time of the year (e.g., from green to yellow to red as time passes).

My steps were:

  1. I created a Material for tree leaves, defining base color, plus a Scalar Parameter for built-in Simple Hue material function, which allows to grade color from green to red. E.g., 1 is base color (green), 1.3 makes base color orange.
  2. I created an Instance for this Material. From the preview window I could change the Scalar Parameter for hue, and tree model reacts by changing colors from green to red OK.
  3. Then I created Foliage Instanced Meshes on my terrain (with Foliage Tool), using tree props as a parent mesh, with Material Instance from point #2. When I change Scalar Parameter for hue in a Material Instance window, I see all right how color changes on all my foliage in the level.
  4. BUT I don’t see a way I could change it dynamically from the Blueprint!

What only I can is to create a single Dynamic Material Instance like it’s explained here http://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/MaterialInstances/index.html#materialinstancedynamic or here Intro to Materials: Dynamic Material Instances cont. | 10 | v4.0 Tutorial Series | Unreal Engine - YouTube . Technically it will be a Blueprint asset, which when placed from the content browser to the level looks like a static mesh, and reacts on my hue changes all right. But I didn’t find a way I could place it on the level as an asset for foliage instanced meshes with Foliage Tool! It can accept only static mesh assets on its input, not a blueprint asset which is my script creating Dynamic Material Instance.

Or am I missing something? I hope so!

Would you be so kind to help me with giving a hint or two where to look at or what am I doing wrong? Thanks a lot!

Such a fool I have been!
All what I needed was to use Parameter Collection like here:

1 Like

You sir made my day! Apparently it’s a good idea to read the whole documentation section before starting with my game. It would have been nice if there were more references to features like this earlier in the documentation, so that you know of their existence before reading everything.