Download

Generally how expensive to use complex shaders?

I’m quite new to shaders, so far I only used Unity’s built in ones (most complicated where there were a diff and normal map+some specularity) and after seeing the material introductory videos i wonder what is the ‘cost’ using a complicated shader. Now i know I can’t get an explicit answer, but maybe you can demonstrate somehow…
So if I used a shader which uses masks and defines different characteristics to different part on the model (metaliness, roughness, opacity,), overlays several maps (diffuse or normal maps) how much would it affect performance? How much cheaper to do whatever I can in Photoshop instead?

In view (in viewport) you can select shader complexity view mode. Everything that is green, is cheap, red is expensive. Usually translucent surfaces will be red. In any case it is not something you should be really worried about, just use these two guid lines:

  1. Use as few as nodes possible to achieve desired effect in material.
  2. Use as few as unique materials as possible. Try to create single master material and reuse it everywhere.

the more you can do before importing the better of course, but how much a shader “costs” depends on the size of the material imported and what nodes you connect to it.
a plain shader with diffuse, normal, specular and AO + a mask texture shouldnt be too heavy.

This shader has 320 instructions, 13 texture samples (varying from 4096 to 256) and 10 masks to mask out anything that shouldn’t glow and when looking at the shader complexity its still regarded “green” (if not slightly dark green).