Download

Shader compilation optimization

Hey, I’m new to unreal and I’m trying to understand how to optimize shaders.

I have a master material with a lot of parameters, heavy but complete. I won’t need it for simple meshes as it needs BaseColor and Normal only.

My question is, it is better to create a new “smaller material”, and then make instances of it, or it will be cheaper to use my big master material as it’s already loaded and compiled in the project and instances won’t change anything.


Also making a node a parameter does affect the performance/ compilation?
Finally, there is a difference between making an instance material from a material (master) and making an instance from an instance?

Big thanks, I hope my questions are clear

Its better to use proper parameters that turn off the compiling based on branching if you want to use a master material.

Its only convenient to do this if you
a) know what you are doing
And b.) Are planning to later modify the way every material works.

If either a or b is false, you are likely better off with a different material for each type of thing you need…

re basing and instace off an instance. It’s a tricky subject. It probably won’t work as you expect it to most of the time…

Thanks for your answer. I don’t know it enough to be able to do a master one with different branches enable or not depend on the instance so I’ll go making a different material for each type…