Home Technical Talk

D3D/OpenGL: Question about shaders in larger projects

Finoli
null
Offline / Send Message
Finoli null
Hi!

I'm a game dev student and last semester we had a '3D-programming' course, in which we did some basic stuff such as rendering a textured quad spinning around in the "scene". We used quite basic vertex-, geometry-, and fragment-shaders to do this.

My question is, how are shaders "managed" in a larger projects?
For example, I might have a sphere in the scene that uses a shader to generate some effect on it, some VS or FS to generate water ripples or waves on a water 'model', etc.
How would all these different shaders be combined in the same project? Do we just create new shader programs for the different shaders(as you can do in OpenGL)? Do you use some kind of condition-statement in the shader and use only one program? Some other approach?
I've heard you really want to minimize API-calls, especially for realtime apps (Multiple shader programs would need at least 2 calls to set the shader programs, EVERY frame.)
I'm really confused about this part, and our next course involves making a small game so this will be quite important I'd imagine. (also im personally very paranoid when it comes to performance; I want to do things right from the start when possible)

Sorry if the question is poorly formulated, hope it makes some sense. ^^'

Regards, E. Finoli

Sign In or Register to comment.