Do I need to use a "Material Instance" instead of the actual "Material" while building levels?

Hey Guys,

I have built a small portion of my first level and I have over 58K Shaders all together.

It just seems like that’s to many for the space that I have covered.

If I use a Material Instance rather than the actual material itself, will that cut down on the amount of shaders, or is that something totally different?

Thanks,
.

It is best to create a few general materials with parameters and then create material instances for your meshes based on the materials. Each material that is in the game needs to be compiled. Use texture parameters in you main materials so that you can switch out the textures in the material instances for your meshes. This will dramatically cut down in the number of shaders that need to be compiled

Under the hood material instances aren’t any different from materials. They’re merely a workflow tool.

A Material is the collection of shaders you use.
A Material Instance is a version of these shaders with different parameters.
There is no additional shader code generated with Material Instances (except Materials that use Static Switches, but that’s another story)
If you apply a Material (not instance) to a Mesh, you are basically using a Default Material Instance

Wow, thanks Gampersnaz, I had a intuitive thought that was happening. There is just too many Shaders for the small level that I have created already.

So, I can still use the materials I just need to make a materiel instance from the source material. Got it.

Then apply those material instances instead of the source material.

I bet this help with performance as well?

Thanks Gampersnaz, I really appreciate it.

Regards,
.

Another reason that Gampersnaz makes sense on this is both LDDC_ShaderCache is 20.4 GB (21,975,312,781 bytes) and SDDC_ShaderCache is 21.5 GB (23,167,044,677 bytes)

There is no way that is best practise workflow, not for what I have created so far…

Regards,
.

In this Tutorial he actually backs up what Gampersnaz and I are saying about how when you compile only the material “Parent” gets compiled, not the material instances, so this is why I have so many Shaders for such a small area.

Source Intro to Materials: Material Instancing | 08 | v4.0 Tutorial Series | Unreal Engine - YouTube

Regards,
.

and now to test this in action.

I have made material instances the main color materials and I am applying them as instances to all the places it needs.

Then I am going to delete my two Shader Cache directores (**LDDC_ShaderCache & SDDC_ShaderCache) **and see if the Shader count goes way down…

I bet it does, but we will see.

Regards,
.

Now where it says “Bake Materials” right below the material selection, when do I want to do this? As soon as I apply the Instance?