2. What is a Shader ?
A shader is a program that runs in the graphics
pipeline in CPU and tells the computer how to
render each pixel.
These programs are called shaders because
they're often used to control lighting and
shading, but they also can handle other special
effects.
4. Graphic rendering pipeline
Consists of six stages:
1. Per-Vertex Operation
2. Primitive Assembly
3. Primitive Processing
4. Rasterization
5. Fragment Processing
5. Per-Vertex Operation
Transform from the local coordinate
system to the 3d world coordinate
system. A model of a teapot in
abstract is placed in the coordinate
system of the 3d world.
Vertex shader comes here.
11. Rasterization
Primitives are then broken down into
smaller units, corresponding to pixels
in the framebuffer. Each of these
smaller units are called Fragments.
Fragment shader comes after here.
15. Per-Fragment Operation
Fragments are submitted to tests:
1. Pixel Ownership - not customizable by applications
2. Scissor - fails if fragment is outside of a specified rectangle
3. Alpha - outcome depends on alpha of the fragment
4. Stencil - outcome depends on value in stencil buffer
5. Depth - outcome depends on depth of fragment
6. Blending - outcome depends on fragment color
7. Dithering - not customizable by applications
8. Logical operations - outcome depends on color of
fragment
19. The goal of the Fragment shader is to provide
Coloring and Texture data to each pixel
heading to the framebuffer.
A framebuffer is a bitmap that is used to
refresh a display from a memory buffer
containing a complete frame of data.
Fragment/Pixel Shader