Download

Material Parameter Collection - Instanced Per Character?

Hi there,

Lets say I have a Pawn and it is called ‘Demon’. There are many Demons of an undetermined quantity throughout the level.

When an event occurs, a Material Parameter changes that affects all of the Dynamic Material Instances on the Demon (There’s 7 materials per character! I must use a collection).

Currently if a value changes it affects every single demon.

I want the Material Parameter to be specific to the single instance of the specified Demon. How do I do this?

Thank you for your time. Edit: Maybe this belonged in rendering :frowning:

Hello,
If you create your instanced materials before play then in your character bp create variables (instanced material type ) (one by different material and you can do it in your character parent to have access to them in all your children). Set them in your default tab. On event : get mesh : set material with the variable you want.

I haven’t yet try to get / set collection parameter. If you try please give feedback ^^

It sounds like you’re saying to do what I’m already doing and trying to replace with a parameter collection.

Currently it creates material instances and stores in array in construction script, then when the parameter changes it loops through array. That’s bad. There’s 7 materials to loop through every time it changes while is almost all the time. Why loop through 7 materials per mesh per event when I could just change a single value of a collection parameter?

If I can’t have a material parameter collection control a single instance of a mesh used multiple times then they might as well be removed from the engine as they serve little purpose.

No, Fen’s suggestion is to set instances in construction script and then manipulate the parameter of that instanced material anytime you want. Material instances use scalar, vector and texture parameters which you can set by right clicking on anything you want to parameterize in your material > convert to parameter. Then you can call that parameter in your character BP. Here are 2 screenshots from the construction script and the event graph:

This way you’ll get per instance change instead of global with parameter collection.

I think you mean ‘Yes’, because the exact thing I asked if Fen was intending is exactly what you’ve posted which is exactly what I already am doing and is exactly what I’m trying to avoid doing because every mesh has eight (not 7, my mistake) materials that need to be changed and looping through them every time is silly.

A parameter collection is here to solve this, however it doesn’t seem to have the obvious functionality to actually do it’s job which makes it useless.

Perhaps I should have illustrated my point with screenshots. Every time a player selects which enemy to attack or interact with by holding control, anything they mouse over has the parameters of 8 (more, actually, when this is done) materials changed causing them to glow/highlight. That’s a LOT of loops when all I should have to do is set a single parameter from a collection.

Here is my construction script:

That should be fine though. The only way you can make use of a collection parameter is to use that Emit parameter in every material, but then you’ll need to give a specific parameter and matrial to every mesh. i.e. Emit_1 for every material of Demon_1, then duplicate those materials > create another parameter called Emit_2, give it to every material of Demon_2, etc.
In any case, if you are trying to make a highlight effect you should look into post process materials instead of this really.

I’ll look into post process materials.

As for making multiple versions, the number is random/undetermined so that’s impossible.

I am not really skilled in material, but for me, or you create all your materials before and set material when you need, which will make a lot of materials but no “loop” cost, or you prepare a generic function to set the values of your parameters when needed which will save a lot of space but will cost ressources.
But, does this really costs ressources to loop when you need? if your loops are on mouse move, you will have even for 10 materials, 3 or 4 parameters to set ? For 2 enemies ? the one no more hovered and the one hovered, as this is not a tick, for me it does not sounds too much, but as i said i am not skilled in material… Only thing would be to compare fps with or without this effect, to know…