Conceptual Overview - Computer Graphics ESM

Computer Graphics Notes ESM

1. What Computer Graphics Is

Computer Graphics is the discipline of converting numerical data into visual representations that humans can perceive and interpret.

Every image displayed on a screen is fundamentally data—geometry, color, and depth—mapped to pixels at precise spatial locations and refreshed over time.

2. Hardware Basics and the Frame Buffer

Input devices such as mouse, keyboard, and tablets generate events and coordinates. Output devices such as CRT, LCD, LED displays, plotters, and printers present the final visual output.

The frame buffer is a contiguous block of memory that stores color values for every pixel.

If resolution is $W \times H$ and color depth is $b$ bits:

$$\text{Memory} = W \times H \times b \text{ bits}$$

Example: $1024 \times 768$ resolution at 24-bit color requires approximately $18\ \text{MB}$.

3. The Graphics Pipeline — Model to Screen

The graphics pipeline transforms abstract models into displayed pixels through ordered stages.

4. Transformations — How Objects Move and Change

Transformations determine how a point changes position, size, or orientation.

Points are vectors and transformations are matrices.

For a point $(x,y)$:

Homogeneous coordinates represent $(x,y)$ as $(x,y,1)$, enabling all affine transformations using a single $3 \times 3$ matrix.

Composite transformations require matrix multiplication in correct order; order is not commutative.

Three-dimensional transformations extend this idea using $4 \times 4$ matrices.

5. Projection — Mapping 3D to 2D

Parallel projection uses parallel projection lines and preserves size regardless of depth.

Perspective projection simulates human vision where distant objects appear smaller:

$$ x' = \frac{fx}{z},\quad y' = \frac{fy}{z} $$

Here, $f$ is focal length and $z$ represents depth.

6. Visible-Surface Algorithms

For each pixel, the visible surface is the one closest to the camera.

7. Rasterization — Drawing Primitives

Rasterization converts geometric primitives into discrete pixels.

8. Clipping — Restricting Geometry to the View

Clipping removes parts of geometry outside the viewing region.

Cohen–Sutherland assigns 4-bit region codes and performs trivial accept, reject, or intersection.

Vertical boundary intersection:

$$y = y_1 + m(x_{clip} - x_1)$$

Horizontal boundary intersection:

$$x = x_1 + \frac{y_{clip} - y_1}{m}$$

9. Color, Shading, and Lighting

Lighting models describe how light interacts with surfaces.

Textures map 2D images onto surfaces using interpolation and mipmapping.

10. Animation — Change Over Time

Animation is defined as controlled change of properties over time.

Panning rotates the camera without translation.

11. Core Algorithms — Pseudocode


DDA Line Algorithm
dx = x2 - x1
dy = y2 - y1
steps = max(|dx|, |dy|)
x_inc = dx / steps
y_inc = dy / steps
for i = 0..steps:
  plot(round(x), round(y))
  x += x_inc
  y += y_inc

Bresenham Line Algorithm (0 ≤ m ≤ 1)
p = 2*dy - dx
for each x:
  if p < 0:
    p += 2*dy
  else:
    p += 2*dy - 2*dx
    y++

12. Numerical Practice and Intuition

Manual numerical problems reinforce understanding of rasterization, transformations, and clipping.

Practicing step-by-step arithmetic exposes precision issues and edge cases.

13. Pitfalls and Deep Insights

14. Exam-Speed Mental Shortcuts