Material Parameter Collections

Hi guys! We have a new post going up for you today. Principal artist Shane Caudle is here to talk to you about Material Parameter Collections, so check it out and be sure to let us know what you think below!
[HR][/HR]

Material Parameter Collections are a super useful new feature in Unreal Engine 4. They are a collection of Scalar and Vector Parameters that can be referenced from any number of other materials or Blueprints. This means they change globally, so if you change the value, everything that uses them changes automatically. This also happens dynamically which makes them super handy!

You can create one like this….

A Scalar Parameter is a single floating point value, and Vector Parameter is four floating point values that could be used for setting a color with an alpha channel, as a vector, or whatever you would like really.
In the sample game Tappy Chicken, I used a Scalar Parameter Collection quite a bit to do things in the materials that would be more expensive otherwise. Since this is an unlit 8 bit looking 2D game, I wanted to simulate fog, time of day changes, and things like screen flash, and fading to black in the materials. This also allows you total control over where and how they are used as well. For example, when I’m tinting the screen to simulate time of day change, I only tint the UI graphics 50%.

Here is the setup I used….

In the material editor to use a Material Collection Parameter, right click in empty space, and select Parameter/CollectionParameter.

3.jpg

Here is the setup showing how I used these Scalar Parameters in the material for the panning background elements.
I used the red channel off the vertex colors of the meshes that make up the scene to add the fog color to the background hills to simulate scene depth.

In the Blueprint, I made a function called SetSkyColor to set all 3 colors so I could easily change the time of day.

Then I made another function called ChooseSkyColor that uses SetSkyColor to randomly choose a time of day.

This is what they look like in game.

These are just some examples of how you can use Material Parameter Collections. This is a great tool to have in your toolbox, so give them a shot and see what creative ways you can use them to enhance your games.

1 Like

Create MPC from Material

Seems to me you’d want a really fast, context-sensitive way to create these, like right mouse on an existing material and creating a MPC from it.

Right now, I make a MPC, then create a Dynamic Material Instance in a blueprint to fetch values from it. But populating those values initially is a lot of work.

Maybe it exists already and I’m too much of a noob to have found it.

You built this in 8hours? I hope to be that fast with UE4 :rolleyes: Good job man!

I working on a farming type game, and with that Material Parameter Collection is that one way I can create crops growing and changing colour?

I used this method in conjunction with a material provided by Ian Shadden to create a spinning globe that is projected from a flat map of tiles.

The power of materials is pretty awesome! And this post should be stickied! :slight_smile: