How many shaders are usually active, at the same time in one scene, in modern games? I know that multiple shaders are being used, with the games switching between them in each frame, and it's common to draw objects via the shader:
- Draw all objects with shader one
- Change from shader one to shader two
- Draw all objects with shader two
Still, I know it's not as simple, especially with effects like a glow effect for whole scene, render to texture, etc., but I guess we can assume it works that way most of the time, right? The "group by shader" approach is good, because switching shaders is an expensive operation.
From one side, you cannot have too many shaders, because you want to render the scene fast. On the other hand, you need many different shaders (or uber-shader with branches - quite similar) for skin, metal, water etc.
How many (and which) different shaders would the theoretical, modern, third person, 3D detective game for PC (DirectX 11, if it matters) use? It would be 5, 20 or more like 100 active shaders, counting only active, at some "frame X"? I know it's not one number, but I wonder what scale and factors are important, in consideration for a PC game.
In my sample game, I would use about 9-11 per frame (count it as different, small shaders or one uber-shader - doesn't matter now):
- Skin shader
- Eye shader (not too much? but they are different)
- Metal shader
- Ground shader
- Snow/rain shader (if required)
- Water shader (if the water exists in scene)
- Glow shader (only when some special effects are involved)
- Light emiter shader (street lamps etc.)
- Standard shader (for all other, just standard shading)
- Standard shader with normal maps
- 2D shader (for GUI etc.)
Is it "much" or "not many"? Did I forget about some important shaders that I would need?