Mass dynamic material instancing?

Hi all

Havent been on here for a while. Life got in the way had to take a job none developer, just to get by. S4!t happens huh!

Anyway. Im way behind the times with Engine versions and anything thats changed, so that said the question:

Last i know the only way to change parameters inside a material at runtime was using Dynamic Materials which are assigned at runtime.

Problem:

Im making a base material for textures that are or can be exposed to the elements.
An example of this is the enabling of rain effects (drips, drops, ripples etc) that can be changed in realtime depending on the weather.

If i create the base material with all these functions inside it would make it more productive to work of this for all the required materials so they all have the same effects.

This means LOTS of materials. How on earth can I reduce the impact on how to interact with these materials? My understanding is find all the materials that use the base material, find their assigned meshes, and raise dynamic instances.

This sounds slow and memory consuming and just downright performance hitting.

Has anything changed in respect to this? or is dynamic materials still the only way to do this? or am I missing something silly ie. can the material get information (like it gets vertex or world coords info) that will allow it to read the information in material at runtime?

Thanks in advance!

Stewart

My suggestion is to look into material functions that can be used in all materials, as well as global parameter collections. These are parameters that can be reused in all materials. It should be all you need, and thus no need for “dynamic materials”. By changing the parameter collection values, the materials should update with the change.

Try it out an let me know how it goes! :slight_smile:

1 Like

thanks @EliasWick

I was already planning using a material function to handle this. But can the parameters be changed at runtime directly into the function? if so this would be perfect, but i was under the impression you couldn’t manipulate the functions from outside the GPU (except via dynamic materials)

If this IS the case however this would be great, I will indeed try this out!

Stewart

Material-instance dynamic, or if you use material-parameter collections, they will be realtime as well.

You will be passing parameters into the material_functions, or else have them defined therein, they will be exposed and manipulable.

1 Like

Thank you both

I didnt realise material parameter collections were changeable at runtime, why i didnt? ignorance i guess on my part!

Only one problem, internet slow today painfully waiting for 5.3 to download and install to play with my new solution!

Thanks @EliasWick & @Frenetic

Haha don’t worry about it! I wish you the best of luck! :slight_smile:

also check out the PerInstance nodes, and Custom Data: Storing Custom Data in Unreal Engine Materials Per-Primitive | Unreal Engine 5.3 Documentation

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