CG SET study materials
CG SET study resources

CG SET cheat sheet

CG SET · Keep the key ideas within reach.

Quick reference

Graphics Mathematics and Geometry

  • Homogeneous point (x,y,z,1) transforms by 4×4 matrix; direction vectors use w=0 so translation is ignored.

  • Column-major convention: p' = M·p; row-major convention: p' = p·M. Mixing them transposes all transforms.

  • Rotation about arbitrary unit axis a by angle θ: R = I cosθ + sinθ [a]× + (1−cosθ) aaᵀ (Rodrigues).

  • Cross product a×b = (a₂b₃−a₃b₂, a₃b₁−a₁b₃, a₁b₂−a₂b₁); |a×b| = |a||b|sinθ, normal to both.

  • Plane equation n·p + d = 0; signed distance from point q is n·q + d when n is unit length.

  • Barycentric coordinates: p = αA + βB + γC with α+β+γ=1; point is inside triangle iff all three ≥ 0.

  • Quaternion q = (w, x, y, z) = (cos(θ/2), sin(θ/2)·axis); slerp interpolates rotations along shortest arc.

  • Eigen-decomposition: symmetric matrices have real eigenvalues and orthogonal eigenvectors; principal axes of inertia use this.

  • Ray–sphere: substitute o+td into |p−c|²=r²; discriminant <0 miss, =0 tangent, >0 two hits; take smallest positive t.

Quick reference

Rasterization and Rendering Pipeline

  • Pipeline order: vertex processing → primitive assembly → clipping → perspective divide → viewport → rasterization → fragment tests → blending.

  • Viewport transform: x_s = (x_ndc+1)·W/2 + X, y_s = (y_ndc+1)·H/2 + Y; z_ndc maps to depth range [near, far].

  • Perspective-correct interpolation divides attributes by w, interpolates linearly in screen space, then divides by interpolated 1/w.

  • Edge function E(x,y) = (x−x₀)(y₁−y₀) − (y−y₀)(x₁−x₀); sign gives inside/outside; all three same sign = inside triangle.

  • Top-left fill rule prevents double-shading pixels on shared edges; avoids gaps and overdraw artifacts.

  • Z-buffer test: depth test LESS, then write; early-Z is disabled by discard, alpha test, or shader depth writes.

  • Clipping to view frustum uses six planes; Sutherland–Hodgman clips polygons, Cohen–Sutherland clips line segments.

  • Backface culling: signed area of screen triangle; counter-clockwise front faces are culled when area sign is negative (OpenGL default CCW front).

  • MSAA anti-aliasing: multiple coverage samples per pixel, one shading per pixel; supersampling shades every sample.

Quick reference

Shading, Lighting, and Global Illumination

  • Lambert diffuse: L_d = k_d (N·L) I / r²; clamp N·L to zero for surfaces facing away from light.

  • Blinn–Phong specular: L_s = k_s (N·H)^n I, H = normalize(L+V); exponent n controls highlight tightness.

  • Rendering equation: L_o(x,ω_o) = L_e + ∫_Ω f_r(x,ω_i,ω_o) L_i(x,ω_i) (n·ω_i) dω_i.

  • BRDF energy conservation: ∫ f_r (n·ω_i) dω_i ≤ 1 for all outgoing directions; diffuse+specular must not exceed 1.

  • Fresnel Schlick: F(θ) ≈ F₀ + (1−F₀)(1−cosθ)⁵; F₀ = ((n₁−n₂)/(n₁+n₂))².

  • Cook–Torrance microfacet BRDF: f = F·D·G / (4 (n·l)(n·v)); D is GGX/Beckmann, G is geometry masking.

  • Path tracing estimator: average over N paths of throughput × emitted radiance; Russian roulette terminates paths unbiasedly.

  • Importance sampling reduces variance: sample directions proportional to BRDF × cosine; pdf appears in the denominator.

  • Irradiance vs radiance: irradiance E (W/m²) is flux per area; radiance L (W/m²/sr) is per solid angle; diffuse reflection uses E.

Quick reference

Texture Mapping and Image Processing

  • UV coordinates in [0,1]²; wrap modes repeat, clamp, mirror; address via frac(uv) for repeat.

  • Bilinear filtering blends 4 texels; trilinear blends two mip levels; anisotropic filtering samples along footprint.

  • Mipmap level L = log₂(max(|du/dx|,|dv/dx|)·textureSize); hardware computes derivatives per 2×2 quad.

  • Seamless tiling requires texture edges to match; mirrored repeat avoids seams for symmetric patterns.

  • Normal mapping perturbs shading normal: N' = normalize(TBN · n_sample); TBN from tangent, bitangent, normal.

  • sRGB textures store gamma-encoded values; decode to linear before lighting, re-encode on output.

  • Convolution: (f*g)[x] = Σ f[k] g[x−k]; Gaussian blur kernel is separable, reducing O(n²) to O(2n) per pixel.

  • Nyquist: sampling rate must exceed twice the highest frequency; aliasing appears as moiré when texture minified.

  • Alpha compositing: C_out = α_s C_s + (1−α_s) C_d for over operator; premultiplied alpha simplifies blending.

Quick reference

Geometric Modeling and Curves/Surfaces

  • Bézier curve: B(t) = Σᵢ C(n,i) (1−t)^(n−i) t^i Pᵢ; endpoints interpolated, interior control points approximated.

  • Cubic Bézier derivative: B'(t) = 3(1−t)²(P₁−P₀) + 6(1−t)t(P₂−P₁) + 3t²(P₃−P₂).

  • de Casteljau algorithm evaluates Bézier by repeated linear interpolation; numerically stable.

  • B-spline basis functions N_{i,k} defined by Cox–de Boor recursion; knot vector controls continuity.

  • Uniform cubic B-spline is C² continuous; clamped knots make curve interpolate endpoints.

  • NURBS adds weights: rational basis wᵢNᵢ(t)/Σ wⱼNⱼ(t); conics (circles, ellipses) are exactly representable.

  • Subdivision surfaces: Catmull–Clark generalizes B-spline to arbitrary topology; Loop scheme for triangle meshes.

  • Half-edge data structure stores each edge as two directed half-edges with next, twin, vertex, face pointers.

  • Euler characteristic: V − E + F = 2 for closed genus-0 polyhedra; genus g gives V − E + F = 2 − 2g.

Quick reference

Animation and Simulation Fundamentals

  • Keyframe interpolation: linear, cubic Hermite (Catmull–Rom), and Bézier with tangent handles for ease-in/ease-out.

  • Quaternion slerp: q(t) = (sin((1−t)Ω) q₀ + sin(tΩ) q₁)/sinΩ; avoids gimbal lock and interpolates shortest arc.

  • Euler angles suffer gimbal lock when middle rotation is ±90°; prefer quaternions or matrices for orientation.

  • Forward kinematics composes joint transforms; inverse kinematics solves for joint angles given end-effector target.

  • Linear blend skinning: p' = Σ wᵢ Mᵢ p; weights sum to 1; artifacts include candy-wrapper twisting.

  • Verlet integration: x_{n+1} = 2x_n − x_{n−1} + a Δt²; symplectic, stable for cloth and particles.

  • Spring–damper: m a = −k x − c v; critical damping when c = 2√(km).

  • Collision detection: broad phase (AABB, spatial hash), narrow phase (GJK, SAT); continuous detection uses swept volumes.

  • Euler integration accumulates energy; semi-implicit Euler (update v then x) is more stable for games.

Quick reference

Graphics Hardware and Real-Time APIs

  • GPU pipeline stages: vertex shader → tessellation → geometry shader → rasterizer → fragment shader → output merger.

  • Vulkan and D3D12 expose explicit command buffers, pipelines, and memory heaps; OpenGL and D3D11 are stateful/driver-managed.

  • Descriptor sets (Vulkan) or root signatures (D3D12) bind resources; double/triple buffering avoids CPU–GPU stalls.

  • Draw call overhead: batching and instancing reduce CPU cost; instanced draw uses per-instance attributes.

  • GPU memory types: device-local (VRAM) fast for rendering; host-visible for staging; use staging buffers for uploads.

  • Compute shaders use workgroups; shared memory is fast but bank conflicts serialize access.

  • Occlusion queries and conditional rendering skip hidden geometry; early-Z rejects fragments before shading.

  • Swapchain presents rendered images; vsync ties presentation to display refresh, causing input latency or tearing.

Quick reference

Color Science and Display

  • CIE XYZ from spectral power distribution: X = ∫ S(λ) x̄(λ) dλ, similarly Y and Z; Y is luminance.

  • Chromaticity: x = X/(X+Y+Z), y = Y/(X+Y+Z); gamut is triangle on xy diagram.

  • sRGB primaries: R(0.64,0.33), G(0.30,0.60), B(0.15,0.06); D65 white point (0.3127,0.3290).

  • sRGB transfer: linear → encoded uses 1.055·L^(1/2.4)−0.055 for L>0.0031308, else 12.92·L.

  • Luminance Y = 0.2126 R + 0.7152 G + 0.0722 B for linear sRGB; coefficients reflect human sensitivity.

  • Delta E (CIE76) = Euclidean distance in Lab*; ΔE < 1 is imperceptible to most observers.

  • HDR displays use PQ (SMPTE ST 2084) or HLG transfer; peak luminance in nits, not 0–1.

  • Additive RGB mixing: equal R+G+B gives white; subtractive CMY mixing gives black.

Quick reference

Professional Practice, Ethics, and Pedagogy

  • Cite all assets and libraries per license; CC-BY requires attribution, GPL requires source disclosure for derivatives.

  • ACM Code of Ethics: contribute to society, avoid harm, be honest, respect privacy, honor confidentiality.

  • Accessibility: WCAG contrast ratio 4.5:1 for normal text, 3:1 for large text; provide captions and keyboard navigation.

  • Constructive alignment: learning outcomes, activities, and assessments must map to the same verbs (e.g., 'implement', 'analyze').

  • Formative assessment (low-stakes practice) improves retention more than summative-only grading.

  • Bloom's taxonomy order: remember, understand, apply, analyze, evaluate, create; use higher verbs for capstone projects.

  • Academic integrity: distinguish collaboration from plagiarism; require attribution of code snippets and AI assistance.

  • Data privacy: FERPA (US) and GDPR (EU) restrict sharing student records and personal data without consent.