Skip to main content
added 625 characters in body
Source Link
Bálint
  • 15.1k
  • 2
  • 38
  • 57

It depends on your needs.

Most of the time you just have separate shaders for separate effects, like reflections water, post-processing or simple shading. This allows the graphics programmers to work in a much more organized way. How you create the actualindividual shaders is however very inconsistent. A post-processing shader (or shaders) usually have a single purpose (e.g. blur), but stuff like lighting is usually just a very big shader that does things differently based on the values passed to it, so the same shader can be used to create metal and dirt.

The other approach is the uber shader. This is a very broad term, and you won't find a lot about it on the internet either. Usually, uber shaders are massive shader programs meant to deal with a variety of rendering situations (however, post-processing is usually not one of them). They either use compile time (#define, #if) or runtime (if (...)) switches to handle different scenarios. Sometimes even water and other reflecting or refracting surfaces are included in the mix. If you want, you can literally include every shader program in a single file, but it's not advised.

The third and in my opinion the most flexible approach are the modular shaders. These are constructed on the fly, usually when the game starts. Instead of having a single pre-defined shaders, you have a lot of self-contained pieces of code, which you put together to form a shader. This has multiple benefits, first it makes creating shaders easy and fast by sacrificing some load time, and second, it makes shaders only do what they need to do, thus avoiding wasting time on things like specularity on a matt object.

It depends on your needs.

Most of the time you just have separate shaders for separate effects, like reflections water, post-processing or simple shading. This allows the graphics programmers to work in a much more organized way. How you create the actual shaders is however very inconsistent. A post-processing shader (or shaders) usually have a single purpose (e.g. blur), but stuff like lighting is usually just a very big shader that does things differently based on the values passed to it, so the same shader can be used to create metal and dirt.

The other approach is the uber shader. This is a very broad term, and you won't find a lot about it on the internet either. Usually, uber shaders are massive shader programs meant to deal with a variety of rendering situations (however, post-processing is usually not one of them). They either use compile time (#define, #if) or runtime (if (...)) switches to handle different scenarios. Sometimes even water and other reflecting or refracting surfaces are included in the mix.

It depends on your needs.

Most of the time you just have separate shaders for separate effects, like reflections water, post-processing or simple shading. This allows the graphics programmers to work in a much more organized way. How you create the individual shaders is however very inconsistent. A post-processing shader (or shaders) usually have a single purpose (e.g. blur), but stuff like lighting is usually just a very big shader that does things differently based on the values passed to it, so the same shader can be used to create metal and dirt.

The other approach is the uber shader. This is a very broad term, and you won't find a lot about it on the internet either. Usually, uber shaders are massive shader programs meant to deal with a variety of rendering situations (however, post-processing is usually not one of them). They either use compile time (#define, #if) or runtime (if (...)) switches to handle different scenarios. Sometimes even water and other reflecting or refracting surfaces are included in the mix. If you want, you can literally include every shader program in a single file, but it's not advised.

The third and in my opinion the most flexible approach are the modular shaders. These are constructed on the fly, usually when the game starts. Instead of having a single pre-defined shaders, you have a lot of self-contained pieces of code, which you put together to form a shader. This has multiple benefits, first it makes creating shaders easy and fast by sacrificing some load time, and second, it makes shaders only do what they need to do, thus avoiding wasting time on things like specularity on a matt object.

Source Link
Bálint
  • 15.1k
  • 2
  • 38
  • 57

It depends on your needs.

Most of the time you just have separate shaders for separate effects, like reflections water, post-processing or simple shading. This allows the graphics programmers to work in a much more organized way. How you create the actual shaders is however very inconsistent. A post-processing shader (or shaders) usually have a single purpose (e.g. blur), but stuff like lighting is usually just a very big shader that does things differently based on the values passed to it, so the same shader can be used to create metal and dirt.

The other approach is the uber shader. This is a very broad term, and you won't find a lot about it on the internet either. Usually, uber shaders are massive shader programs meant to deal with a variety of rendering situations (however, post-processing is usually not one of them). They either use compile time (#define, #if) or runtime (if (...)) switches to handle different scenarios. Sometimes even water and other reflecting or refracting surfaces are included in the mix.