Chapter 5: Graphics Processing

sat(x) = min(max(0,x),1)
nrm(x) = v / ||v|| = normalize

5.2/5.3 Color Space and Gamma Correction

pixel: short for 'pixel element'

gamut: the set of all colors that can be reproduced in the RGB scope

sRGB: The given color value has been gamma corrected (color(1/γ))

matrix transforming a color from XYZ space to sRGB space:

Linear: The given color value has NOT been gamma corrected

sRGB/Linear Conversion: most image formats store in sRGB/gamma corrected format, but the graphics code happens in linear, then reconverted to sRGB before being displayed. There is generally hardware support to automatically convert between the two.

Gamma Correction Example:

Linear color to sRGB color and sRGB color to linear:

Gamma correction graph:

5.4 World Structure

Objects in a world called "nodes", which can be:

Coordinate spaces: object space, world space, camera/view space, tangent space, viewport space/window coords/screen coords, normalized device coordinates

Model Matrix: an objects model-to-world space transformation matrix first 3 columns are the directions into world space, and the fourth column represents the location/translation of the object in world space

Common world space coords: the book uses x points right, y points forward, z points upward (right = [1,0,0], forward = [0,1,0], up = [0,0,1]). Another common is x points right, y points up, -z points forward (right = [1,0,0], forward = [0,0,-1], up = [0,1,0]. To convert from y-up to z-up, pz-up = py-up(x,-z,y,w). To convert from z-up to y-up, py-up = pz-up(x,z,-y,w).

Transform hierarchy: nodes are organized in a tree with parents and subnodes. The transform/coordinate space of children are relative to their parents

5.5 Graphics Pipeline

Pipeline Stages:

Post Transform Cache: when using indexed triangles for drawing, the post-transform cache can be used to store already accessed indices

Vertex List Types:

Scissor Test: the GPU uses this to ensure triangles outside of the viewport are not drawn. There is extra data outside of the viewport which is split into 'scissor rectangles':

Stencil and Depth Tests: optional pipeline stages used to generate effects like shadows