How much performance cost for adding many material parameters such as normal intensity, macro variation, etc
Is it considered alright to have a huge, all encompassing master material, even if most features are disabled with switches? If a switch is off, does all performance related to the features go away?
False -> use only texture
True -> Looooots of stuff
If set to false, is performance better or does material still compute all nodes?
A regular material with only 3 textures has:
Info Base pass shader with static lighting: 122 instructions Info Base pass shader with only dynamic lighting: 94 instructions
While a fairly large material I made has:
Info Base pass shader with static lighting: 140 instructions Info Base pass shader with only dynamic lighting: 114 instructions
Is this a large difference?
asked Feb 21 '17 at 09:49 PM in Rendering
Haha you should be fine for 140 instructions. As a rule once the instructions pass 300 on a master material you should start worrying.
Having a big master material means the game only needs to load it once, and then the material instances will take what they need from that loaded material. It's the same logic for texture atlasing; you have one big texture for multiple materials that are often loaded in together, to save on space and processing power. At the same time it's a bad idea to cram everything into one super big material with 600+ instructions, cause either load times will be astronomical, or your GPU will bottleneck.
So basically make a master material for each major material 'type' in your game, eg. standard Lit, POM, transparent, tesselated, ect, and then use material instances for variants. That way you can have a balance between complex shaders and GPU performance.
answered Mar 19 '17 at 06:53 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here