跳到主要内容

11 Computer Graphics

What is Computer Graphics?

Computer Graphics is the field that studies how to generate, manipulate, and display visual content using computers.

It includes:

  • 2D and 3D image generation
  • Modeling, rendering, and animation
  • Visualization and interactive systems
  • User interfaces and human-computer interaction

Historical Milestones

Utah Teapot (1975)

  • A mathematically modeled 3D object
  • Became a standard test model for rendering algorithms
  • Important for its simplicity and shared geometry

Cornell Box (1984)

  • A physical test scene used to evaluate rendering methods
  • Designed to study global illumination
  • Demonstrates effects such as:
    • Soft shadows
    • Color bleeding (e.g., red wall tinting white wall)

Rendering Fundamentals

Ray Tracing Pipeline

Typical ray tracing process:

  1. Camera emits a view ray through the image plane
  2. View ray intersects a scene object
  3. At the intersection point:
    • A shadow ray is cast toward the light source
  4. If the shadow ray is blocked → point is in shadow

Key properties:

  • Rays originate from the camera, not the light
  • If no intersection occurs, no shadow ray is needed

Global Illumination

Radiosity

  • Models light transfer between diffuse surfaces
  • Captures indirect lighting effects
  • Produces realistic:
    • Soft shadows
    • Color bleeding

Differentiable Simulation (DiffSim)

Differentiable Simulation enables:

  • Computing gradients of outputs with respect to inputs
  • Optimizing control parameters using gradient-based methods

Example (1D motion):

  • State update: xt+1=xt+utx_{t+1} = x_t + u_t
  • Loss: L=(x2T)2L = (x_2 - T)^2

Using the chain rule, gradients can be propagated through time.

Applications:

  • Robotics control
  • Physics-based learning
  • Simulation-based optimization

Performance and Hardware Acceleration

  • GPUs: SIMT architecture, good for parallel workloads
  • TPUs: Systolic arrays, optimized for dense tensor operations

If a simulator (e.g., MJX) runs much faster on TPUs than GPUs:

  • The simulation is likely expressed as large tensor operations
  • Implemented using JAX-style differentiable computation
  • Avoids branching-heavy classical physics engines

Geometry and Curves

Bézier Curves

A cubic Bézier curve is defined by four control points: P0,P1,P2,P3P_0, P_1, P_2, P_3

Parametric form:

B(t)=(1t)3P0+3(1t)2tP1+3(1t)t2P2+t3P3\begin{equation*} B(t) = (1-t)^3 P_0 + 3(1-t)^2 t P_1 + 3(1-t) t^2 P_2 + t^3 P_3 \end{equation*}

Properties:

  • Tangent at ( t=0 ): direction ( P_1 - P_0 )
  • Tangent at ( t=1 ): direction ( P_3 - P_2 )
  • The derivative of a Bézier curve is itself a Bézier curve of degree ( n-1 )

Scope of Computer Graphics

Computer Graphics covers:

  • Rendering (rasterization, ray tracing)
  • Geometry modeling
  • Animation and simulation
  • Visualization
  • Interaction and UI systems