[QUOTE=RyanT;12047]Just curious, are you speaking about material instances here? I might be interpreting your reply wrong. I was always under the impression that if you used a switch and made an instance from that material with the switch on (or any parameter change), the expense would be minimal as the data is already compiled just not used in the ‘off’ state.[/QUOTE]
For every switch, a shader is written both with and without the information past the switch. The material instances will only reference the shader that is set as the parent, but if you use both sides of the switch in the same map on different material instances, you will infact incur the cost of both shaders. This can get really silly when you have multiple switches to turn off things like normal maps, specular, or cube maps in the master shaders.
This also holds true for the usage flags. If it’s marked to be used with Skeletal, static lighting, and foliage, you will have sets of shaders for EACH usage flag set.
It can add up really quickly when you have multiple master shaders set to multiple types of objects.
Material instances of materials are INCREDIBLY cheap. However, you must still eat the cost of each possible permutation (but only once, everything else is just the slight cost of the material instance).
I encourage people using switches to use them wisely. If you’re using a switch to turn off one node, such as a 3 vector colorization, I recommend eating the 1 instruction of performance over the wasted memory that comes from having a second copy of the shaders. If it’s for something complex like a cube map that has transforms with colorization which can add 15-20 instructions, then maybe it’s worth the memory.
You should definitely do an analysis locally using the dumpshaders commandlet to see just how much memory you’re using for all the iterations of the shaders. It can grow to 20MB+ on the consoles if you have a ton of master shaders used on multiple object types.
So to sum it all up, yes, you are saving on rendering cost on individual MaterialInstances by having switches, but shader cost in memory is made worse by the amount of switches