Is it better to have one BIG (“uber”) shader, or individual ones and switch between them when needed.
For example right now I’m working on a toon shader which I want to apply to two separate objects of my character - his body and his head. Both of them act the same (in terms of toon shading everything) however on the head I want to have some UV animation. Is it better in terms of performance to have two versions of a shader that are 90% similar, or to have one shader that can toggle on/off extra functionality?
This example could easily be extended; With different effects on objects (ie: on fire? Toggle on a scrolling detail map! Glowing? Toggle on a emissive texture, etc)
There isn’t really a standard way to do it- It really depends on your situation. If your concern is performance on low end devices, having everything be on one shader and material will allow those objects to be combined or batched, thus reducing draw call count.
It is not trivial to toggle on and off functionality in a shader. Graphics hardware is well optimized for linear code paths- introducing conditional branching has its own performance implications. I believe that Unity 5 will have a standard Uber shader that conditionally includes different effects, depending on if you actually use them or not- but I think( correct me if I’m wrong) that it’s making different permutations of the same shader.