is material instance cost as same as its parent?

is material instance cost as same as its parent?

yes.
The thing is, if you use parameters for textures, scalar values, vector 3’s, booleans etc…
any calculation that stays the same compared to the master material (parent) doesnt need to be recalculated.
this results in instanced materials being more optimal.

Even more advanced stuff can result in master instanced materials that control instanced materials :stuck_out_tongue:
I actually made a tutorial about that a few weeks back: [UE4] Explaining Master Materials, Master Instances, Instances. (poorly) - YouTube

1 Like

lets say master costs 100. And we have master + 3 instances. Here is the scenarios

a) 100 ( instances free ) b) 400 ( 100 for each material ) c) 160 ( 100 for master and cheap value for instances )

What is the correct answer.

thats not exactly whats going on.

This will be just an example, but the ideology should be the same.
Lets say a material has four textures (costing 25 each), and a lot of material functions that cost 100 as well.
Also a scalar parameter costing 10.
thats a total of 210 in the master material.

Now in the material instance, you only change one texture.
that means 185 of the master is just passed trough, and the texture is a unique new 25.
185 old, 25 new.

if you now change the scalar, its 175 old, 35 new.

now if you make an instance of that instance and change another texture.
its 150 older, 35 old, 25 new.

also instances arent entirely free, obviously using them also costs a little, but less than an entirely new master.

also using multiple instances on one mesh doesnt help performance that much, as each additional material/matinstance will add a drawcall.

1 Like

Let me check .i have 2 master materials. first one costs 100 and second one costs 1000.i created an instance for each one and i changed the base color for both. finally instances costs same?

yes.
:slight_smile:

Just to clarify, if I’m not changing any of the values other than material parameters to swap out the albedo, normal, RMAO etc. then an instance isn’t any cheaper. IE for character materials.

It’s only cheaper when the materials are sharing calculations - For example a flag material with panners and textures feeding into a world position offset to simulate wind - The initial cost is calculating the first flag’s math but every material instance that simply changes a color parameter will incur a slight cost for the color change but will get a free ride for the math that’s handling the world position offset?