Lecture 1: Introduction to Computer Graphics
Functions of computer graphics:
- Information display: big data e.g. weather, medical
- CAD (Computer Aided Design): architecture, mechanical parts, circuit design
- Virtual reality: training for surgery, flight simulation
- Simulation and animation: games, movies. Hobbit, Ikea, sports
What is a graphics system?

Application is on CPU...sends info to GPU...sets pixels in the frame buffer.
Most modern graphic systems are raster-based: screen display is array (raster) of pixels (picture elements). Each pixel corresponds to a location on the screen. Pixels are stored in part of memory called the frame buffer.
resolution = # of elements in the frame buffer (e.g. 1280x800)
depth, precision of the frame buffer = # bits used for each pixel. 1 bit = 2 colors (0 or 1); 8 bit = 2^8 = 256 colors.
full-color, true-color, RGB systems = 24+ bits per pixel: individual groups of bits in each pixel are assigned to each of 3 primary colors.
GPU: takes specifications of graphical primitives generated by application program and assign values to pixels in frame buffer that best represent these entities.
e.g. triangle is specified by three vertices; graphics system must generate set of pixels that appear to viewer as triangle
rasterization = conversion of geometric entities to pixel colors and locations in frame buffer
IMAGE FORMATION
Physical approach: e.g. ray tracing: follow rays of light until they are absorbed by objects or go off to infinity. Can handle global effects such as multiple reflections, translucency; produces photorealistic images. But: slow, must have entire set of images available at all times.
Instead, we use "good enough" approach: process objects one and a time in order generated by application. Not as realistic -- can consider only local lighting -- but very fast!
Pipeline architecture:
significantly speeds up throughput = rate at which data flows through system. Pipelines are perfect for graphics: millions of pixels and vertices to be processed.
Old pipeline: fixed functionality: application program could set parameters and state variables, but only fixed set of basic operations available within pipeline. Modern pipeline: programmable: now every application program must provide a vertex and fragment shader: a program that applies effects to the vertices and fragments

Application program produces set of objects --> each object defined by set of primitives --> each primitive described by set of vertices. This describes geometry of scene -- what it's really like. May be defined by thousands or millions of vertices.
Vertices are then sent to GPU, go through graphics pipeline.
Vertex processor: a) converts object representations from one coordinate system to another: object coordinates --> camera coordinates --> screen coordinates. Each change equivalent to matrix transformation. b) computes vertex colors.
Primitive assembly: vertices are collected into geometric objects (line segments, polygons, curves and surfaces) before clipping and rasterization can take place. (can't clip out a vertex without also clipping the part of the object it represents; rasterization doesn't make sense for vertices -- would just be a bunch of dots). Clipping: we model scene and image separately, so there may be parts of scene that don't fall within viewing volume; they are clipped out. Output of this step is set of primitives whose projections appear in the clipping volume.


Rasterization: produces set of fragments for each object. Fragments are potential pixels: have location in frame buffer, have color and depth attributes. Rasterizer interpolates vertex attributes over objects (e.g. if each vertex is green, all fragments will be green; if each vertex is red, green or blue, fragments will be spectrum between those colors.)
Fragment processing: colors of corresponding fragments are determined (may apply effect such as bump mapping), hidden-surface removal: fragments may be blocked by other fragments closer to the camera (remember, we're processing in order of objects sent by application program)
All images borrowed from the Angel book