Shaders

Hi, guys.

I was thinking of shaders and some questions came to my mind:

How many shaders do modern games use?(Like those .txt files, that I am usually writing, or maybe they also have some other forms) What kind of tasks they should solve? In my current programs I use about 2 shaders for simple rendering and translating/rotating of some object, but what about huge projects like COD, Diablo 3 and many others? What will be considering as a bad style relative to their usage?

Can someone give some articles or books about them, please? :confused:

How many shaders do modern games use?

I’m not sure what the answer to this question would mean for you. What does it matter if some game engine uses 5 shaders or 5000?

Engines use however many shaders they need to in order to do what they do. Some engines use more, some use less. Some engines build “uber-shaders”, which are monolithic programs that could do anything. Other engines don’t. Some engines build shaders dynamically, so that the number of shaders depends on the scene.

What kind of tasks they should solve?

Rendering tasks; it’s pretty much what they’re for. Even most uses of GPU-based physics only really use them for physics that’s directly tied into some form of rendering (ie: particle systems). Physics that needs to affect gameplay (and therefore requires CPU intervention) doesn’t usually use shaders.

What will be considering as a bad style relative to their usage?

It’s not clear what you’re talking about here. What kind of stylistic issues are you concerned with?