webdevelopment: Alain Brusch
Back
Shaders – openGL Shading Language

GLSL refers to openGL shading language, which is known as the standard of shader programs. Gonzalez Vivo & Lowe refer to the revolutionary computational technique, fragment shaders, which have the ability to take generated images to the next level, being the equivalent of Gutenberg's press for computer graphics (Gonzalez Vivo & Lowe, 2014). Shaders provide overall control over pixels rendered on the screen at very high efficiency making them ideal as they can be used in many different places such as video filters on cell phones or 3D video games. Due to their performance, shaders are quite attractive to designers but also require coding experience, where basic knowledge of linear algebra and trigonometry is helpful (Gonzalez Vivo & Lowe, 2014). When working with shaders each pixel and thus the texture can be altered in any desired way. There are two types of shaders; vertex and fragment shaders. One main difference between vertex and fragment shaders is that a vertex shader can manipulate the attributes of vertices. The fragment shader on the other hand is responsible for how the pixels between the vertices look. They are interpolated between the defined vertices following specific rules.

shaders are somewhat the equivalent of the Gutenberg press for computer graphics
"Imagine the CPU of your computer as a big industrial pipe, and every task as something that passes through it - like a factory line. Some tasks are bigger than others, which means they require more time and energy to deal with. We say they require more processing power. Because of the architecture of computers the jobs are forced to run in a series; each job has to be finished one at a time. Modern computers usually have groups of four processors that work like these pipes, completing tasks one after another to keep things running smoothly. Each pipe is also known as a thread." Gonzalez Vivo & Lowe, 2014
"Let's go back to our metaphor of the pipes and tasks. Each pixel on the screen represents a simple small task. Individually each pixel task isn't an issue for the CPU, but (and here is the problem) the tiny task has to be done to each pixel on the screen! That means in an old 800x600 screen, 480,000 pixels have to processed per frame which means 14,400,000 calculations per second! Yes! That’s a problem big enough to overload a microprocessor. In a modern 2880x1800 retina display running at 60 frames per second that calculation adds up to 311,040,000 calculations per second. How do graphics engineers solve this problem?" Gonzalez Vivo & Lowe, 2014
"Picture the tiny microprocessors as a table of pipes, and the data of each pixel as a ping pong ball. 14,400,000 ping pong balls a second can obstruct almost any pipe. But a table of 800x600 tiny pipes receiving 30 waves of 480,000 pixels a second can be handled smoothly. This works the same at higher resolutions - the more parallel hardware you have, the bigger the stream it can manage." Gonzalez Vivo & Lowe, 2014