CS 488 (Exam Review)

No shader questions, probably no coding questions. Set of Sample Exam Questions, likely that a few appear on the exam. Questions that have not showed up on an exam in a long time are less likely to be asked.

  1. History (Nothing).
  2. Devices (Nothing).
  3. Device Interfaces (Nothing).
  4. Geometries (Won’t be tested in depth).
  5. Affine Geometries & Transformations.
  6. Windows, Viewports, NDC.
  7. Line Clipping.
  8. Projections.
  9. A2 (Nothing).
  10. Polygons.
  11. Hidden Surface Removal.
  12. Hierarchical Models & Transformations.
  13. Rotations About Arbitrary Axis.
  14. Picking (Nothing)
  15. Colour (Minor things).
  16. Lighting.
  17. Shading.
  18. Graphics Hardware (Nothing).
  19. ++ Ray Tracing ++
  20. Aliasing.
  21. Bidirectional Tracing (Not tested in depth).
  22. Radiosity (Not tested in depth).
  23. Photon Mapping (Not tested in depth).
  24. Shadows, Projective, Shadow Maps, Volumes (Not tested in depth).
  25. Modelling Stuff (Short answers only if anything).
  26. Polyhedral Data Structures (Nothing).
  27. Splines, De Casteljau’s Algorithm (Lightly tested).
  28. Non-Photorealistic Rendering (Very lightly tested).
  29. Volume Rendering (Nothing).
  30. Animation (Might be short questions).
  31. Computational Geometry (Nothing).

Geometries

Vector Spaces

Set of vectors V with two operations.

  1. Addition: u + v \in V.
  2. Scalar Multiplication: \alpha v \in V, where \alpha is a member of some field \mathbb{F}.

Axioms.

Span

Suppose B = \{v_1, v_2, ..., v_n\}. B spans V if and only if any v \in V can be written as v = \sum_{i=1}^n \alpha_i v_i (linear combination of the vectors in B).

Affine Spaces

Now we use a set of points P in addition to the set of vectors V.

Inner Product Spaces: Binary operator which is commutative, associative, scalar multiplication distributes, u \cdot u \ge 0 if and only if u = 0.

Euclidean Spaces

Metric Space: Space with a distance metric d(P, Q) defined. Requires distance be non-negative, zero if and only if the points are identical, commutative, and satisfy triangle inequality.

Euclidean Space: Metric space based on a dot (inner) product, d^2(P, Q) = (P - Q) \cdot (P - Q).

Cartesian Space

An Euclidean Space with a standard orthonormal frame (i, j, k, O).

For notation, we specify the Standard Frame F_s = (i, j, k, O).

Since points and vectors are different objects with different operations and behave differently under transformations how do we handle them?

Coordinates: We use an extra coordinate.

Why Do We Need Affine Spaces?

Affine Geometries & Transformations

Linear Combinations

Affine Combinations

Affine Transformations

Let T: A_1 \to A_2, where A_1, A_2 are affine spaces.

Then T is an affine transformation. Preserves affine combinations on the points.

Suppose T is only defined on P. Then T(v) = T(Q) - T(R), where v = Q - R.

Mapping Through an Affine Transformation

Let A, B be affine spaces, with T: A \to B be an affine transformation. Let F_A = (v_1, v_2, O_v) be a frame for A, let F_B = (w_1, w_2, O_w) be a frame for B. LetP be a point in A whose coordinates relative to F_A = (p_1, p_2, 1). What are the coordinates (p_1^\prime, p_2^\prime, 1) of T(P) relative to frame F_B?

\begin{aligned} T(P) &= T(p_1 v_1 + p_2 v_2 + O_v) \\ &= p_1T(v_1) + p_2 T(v_2) + T(O_v) \\ \end{aligned}

Geometric Transformations

Change of Basis

Suppose we want to change coordinates relative to F_1 to coordinates relative to F_2. We know that P = [x, y, 1]^T relative to F_1 = (w_1, w_2, O_w). Solve F_1 = F_2 M_{1, 2}.

World and Viewing Frames

After we are in viewing coordinates, we place a clipping box around the scene relative to the viewing frame.

Transforming Normals

Windows, Viewports, NDC

Window to Viewport mapping is simple a scale based on the ratios and an offset based on their positions.

Normalized Device Coordinates

We want to specify the viewport in a generalized way so that it works on all plaforms / devices. So we use Normalized Device Coordinates as an intermediate coordinate system.

Line Clipping

Clipping is removing points outside a region of interest.

for P, n in edges: # Halfspaces
    wecA = dot(A - P, n)
    wecB = dot(B - P, n)

    if wecA < 0 and wecB < 0:
        reject # Outside
    if wecA >= 0 and wecB >= 0:
        next # Inside

    t = wecA / (wecA - wecB)

    if wecA < 0:
        A = A + t * (B - A)
    else:
        B = A + t * (B - A)

Projections

Perspective Projection

Perspective Map

For projection plane z = d.

3D Clipping

Polygons

Area primitive.

Polygon Clipping

Algorithm: Four cases to consider.

  1. Polygon edge is entirely inside the window edge.
  2. Polygon edge crosses window edge going out.
  3. Polygon edge is entirely outside the window edge.
  4. Polygon edge crosses window going in.

Polygon Scan Conversion

Hidden Surface Removal

When we have a lot of polygons, we want to draw only those visible to the viewer.

Backface Culling

Painter’s Algorithm

Warnock’s Algorithm

Divide and conquer algorithm.

Z-Buffer Algorithm

Hierarchical Models & Transformations

How do we model complex objects and scenes?

Rotations About Arbitrary Axis

Rotation given by a = (x, y, z) and \theta. Map a onto one of the canonical axes, rotate by \theta, then map back.

  1. Pick closest axis to a. Assume we chose the x-axis.
  2. Project a onto b in the xz plane.
  3. Compute \cos(\phi) = \frac{x}{\sqrt{x^2 + z^2}}, \sin(\phi) = \frac{z}{\sqrt{x^2+z^2}}.
  4. Create R(-\phi).
  5. Rotate a onto the xy plane using R(-\phi). c = R_y(-\theta)a.
  6. Compute \cos(\gamma), \sin(\gamma), where \gamma is the angle of c with the x axis.
  7. Use \cos(\gamma) and \sin(\gamma) to create R_z(-\gamma).
  8. Rotate c onto the x-axis using R_z(-\gamma).
  9. Rotate around the x-axis by \theta, R_x(\theta).
  10. Reverse z-axis rotation.
  11. Reverse y-axis rotation.

So the overall transformation is R(\theta, a) = R_y(\phi)R_z(\gamma)R_x(\theta)R_z(-\gamma)R_y(-\phi).

3D Rotation User Interfaces

Colour

Tri-Stimulus Colour Theory

Colour Systems

Lighting

Given a point on the surface visible through a pixel, what colour should we assign it?

Initial Assumptions

Lambertian Reflection

Assume that incoming light is partially absorbed, then the remainder of energy is propogated equally in all directions.

Attenuation

Ambient Light

Specular Reflection

Shading

Flat Shading

Gouraud Shading

Phong Shading

Ray Tracing

for pixel in pixels:
    ray = (eye, pixel - eye)
    Intersect(Scene, ray)

Intersection Computations

Quadratic Surfaces.

Shading

Reflections

Recursive Ray Tracing

Ray Casting

Surface Normals

Normal Transformations

How do affine transformations affect surface normals?

Modeling and CSG

Texture Mapping

Adding detail by increasing model complexity is costly. When the detail is surface detail, we can use texture mapping.

Bump Mapping

Solid Textures

Bounding Boxes, Spatial Subdivision

Spatial Subdivision

Aliasing

Nyquist Limit

Area Sampling

Weighted Sampling

Anti-aliasing in Ray Tracing

Bidirectional Tracing

Some effects such as caustics require tracing lights from light back to eye.

Radiosity

Distribution Ray Tracing

Bidirectional Path Tracing

Trace paths from eye and from light and connect them. Trace paths (single reflected ray).

Photon Maps

Metropolis Algorithm

Radiosity

Radiance: Total energy flux comes from flux at each wavelength L(x, \theta, \phi) = \int_{\lambda_{min}}^{\lambda_{max}} L(x, \theta, \phi, \lambda)d\lambda.

Radiosity: Total power leaving a surface point per unit area \int_0^{\frac{\pi}{2}}\int_0^{2\pi} L(x, \theta, \phi) \cos(\theta) \sin(\theta) d\phi d\theta.

Bidirectional Reflectance Distribution Function

Simple Energy Balance (Hemisphere Based)

B(x) = E(x) + p_d(x) \int_{\Omega} L^i(x) \cos(\theta^i_x) d \omega

In general we have L^i(x, \theta^i_x, \phi^i_x) = L^o(y, \theta^o_y, \phi^o_u) for some y. In other words, the radiance comes from some incident radiance. So we simplify with \theta^i_x = \theta_{xy}, \theta^o_y = \theta_{yz} and L^i(x) = \frac{B(y)}{\pi}.

B(x) = E(x) + p_d(x) \int_{y \in S} B(y) \frac{\cos(\theta_{xy})\cos(\theta_{yx})}{\pi ||x - y||^2} H(x, y) dA(y)

Piecewise Constant Approximation

B(x) \approx E(x) + p_d(x) \sum_j B_j \int_{y \in P_j}\frac{\cos(\theta_{xy})\cos(\theta_{yx})}{\pi ||x - y||^2} H(x, y) dA(y)

B_i = E_i + p_i \sum_j B_j \frac{1}{A_i} \int_{x \in P_i} \int_{y \in P_j} \frac{\cos(\theta_{i})\cos(\theta_{j})}{\pi ||x - y||^2} H(i, j) dA_j dA_i

So given all of the form factors, we have linear equations B_i = E_i + p_i \sum_j F_{ij} B_j, B_i = E_i + p_i \sum_j F_{ji} \frac{A_j}{A_i} B_j.

Matrix Form

Calculating Form Factors

Hemi-sphere Form Factors

Hemi-cube Form Factors

Delta Form Factors

Progressive Refinement

def shoot(i):
    For all j, calculate F_ji
    For every j:
        d_rad = pj * dB_i * F_ji * A_i / A_j
        dB_j += d_rad
        Bj += d_rad
    dB_i = 0

while unshot > EPS:
    Choose patch i with highest d_B
    shoot(i)

Meshing in Radiosity

Adaptive Subdivision

Stochastic Methods

Photon Mapping

  1. Emit photons.
  2. Trace photons, store in data structure.
  3. Estimate irradiance with k nearest neighbour search.
  4. Ray trace, using estimated irradiance.

Shadows, Projective, Shadow Maps, Volumes

Projective Shadows

For drawing shadows on a plane.

Shadow Maps

Shadow Volumes

  1. Draw scene normally.
  2. Draw in stencil buffer, front facing shadow polygons using previous depth buffer. Increment stencil buffer on draws.
  3. Draw in stencil buffer, backfacing polygons. Decrement stencil buffer on draws.
  4. Redraw scene with light off, but only update pixels with exact depth match and non-zero stencil value.

Modelling Stuff

Fractal Mountains

L-system Plants

Buildings

Partical Systems

Splines, De Casteljau’s Algorithm

de Casteljau Algorithm

Geometric view.

Expanding Terms (Basic Polynomials)

Bernstein Polynomials

Bezier Splines

Interpolation

Derivatives

\frac{d}{dt} B_i^n(t) = n(B^{n-1}_{t-1}(t) - B_i^{n-1}(t)), so P^\prime(t) = n(P_1 - P_0), P^\prime(1) = n(P_n - P_{n-1}).

Smoothly Joined Segments (C^1)

Smoothly Joined Segments (C^1)

C^2 Continuity

Recurrence, Subdivision

\begin{aligned} P(t) &= P_0^n(t) \\ P_i^k(t) &= (1 - t)P^{k-1}_i(t) + tP_{i+1}^{k-1} \\ P^0_i(t) &= P_i \end{aligned} Use to evaluate point at t, subdivide into two new curves.

Spline Continuity

Piecewise Polynomials

C^0 Piecewise Cubic Bezier

C^1 Piecewise Cubic Bezier

We also need P_3 - P_2 = Q_1 - Q_0.

\begin{aligned} P_{i,0} &= P_i \\ P_{i,1} &= P_i + \frac{v_i}{3} \\ P_{i,2} &= P_{i+1} - \frac{v_{i + 1}}{3} \\ P_{i,3} &= P_{i+1} \end{aligned}

C^2 Piecewise Cubic Bezier

Tensor Product Patches

Smoothly Joined Patches

Rendering

Tensor Product B-splines

Problems with tensor product patches arise when data is non-rectangular.

Triangular de Casteljau

Continuity between two patches is easy, hard for n patches. In general, joining things together with tensor product or triangular patches is hard.

Subdivision Surfaces

Topological Subdivision

Implicit Surfaces

Rendering Implicit Surfaces

Wavelets

1-D Haar

2D Haar and Image Compression

Non-Photorealistic Rendering

Painterly Rendering

Pencil Rendering

Silhouettes

Toon Shading

Animation

Automated Keyframing

Functional Animation

Linear Interpolation

Spline Interpolation

Transformation Matrix Animation

Rigid Body Animation

Motion Path Animation

Motion Path Spline Interpolation Problems

Spline position interpolation gives continuity control over changes position but.

Arc Length Parameterization

  1. Given spline path P(u) = [x(u), y(u), z(u)], compute arclength of spline as a function of u, s = A(u).
  2. Find inverse of A(u).
  3. Substitute u = A^{-1}(s) into P(u) to find motion path parameterized by arclength.

There is no analytic solution if the motion path is a cubic spline. So exact arc-length parameterization is not reasible.

Approximate Arc Length Parameterization

Orientation and Interpolation

Quaternions

Four-dimensional analogs of complex numbers. Used to represent orientation. Recall that multiplication of complex numbers represents orientation and rotation in the plane (e^{i\theta}).

\begin{aligned}i^2 = j^2 = k^2 &= -1\\ ij = -ji &= k\\ jk = -kj &= i\\ ki = -ik &= j\end{aligned}

Multiplication does not commpute.

Unit Quaternions

Rotations

Interpolating Unit Quaternions

Tools for Shape Animation

Kinematics and Inverse Kinematics

Kinematics: Study of motion independent of the forces that cause the motion.

Physically-Based Animation

Spring-Mass Models

Morphing

Motion Capture

Flocking