Computer Graphics

Outro

Prof. Dr. David Bommes
Computer Graphics Group

Exam

  • 12.01.2026, 10:15, ExWi A006
  • Don’t forget to register in KSL
  • Total exam time: 90 minutes
  • Be there at 10:00am and take a seat such that we can start in time
  • You can bring one A4 sheet with handwritten notes on both sides
    • no additional notes, books, electronic devices, etc.
  • Bring your student ID!
  • Topics: Everything from the lecture and the homework!

Course Recap

Colors

  • Light in Physics
    • electromagnetic wave, power spectrum
  • Colors in Biology
    • rod and cone receptors
  • CIE Color System
    • tristimulus vector
  • Color Models in Computer Graphics
    • CIE ZYZ, RGB, CMY, HSV, HSB, conversions

Raytracing

  • Assumptions on light
    • geometric optics
    • RGB approximation
    • No participating media
    • Superposition
  • Pinhole Camera Model

Basic Ray Tracing Pipeline

  • Implementing a ray tracer basically comes down to three operators that we have to understand and implement.

images/ray-tracing-pipeline.svg images/ray-tracing.svg

Ray-Object Intersections

  • Approach I: insert parametric ray equation into implicit object representation and solve for \(t\)
  • Sphere \[ \norm{ \vec{o} + t\vec{d} - \vec{c} } - r = 0 \]
  • Plane \[ \transpose{\vec{n}} \left(\vec{o} + t\,\vec{d} \right) - d = 0 \]

Ray-Triangle Intersection (explicit)

  • Ray and triangle have to coincide \[ \vec{o} + t\,\vec{d} \;=\; \alpha\vec{A} + \beta\vec{B} + \gamma\vec{C}\]
    Four unknowns, but only three equations!
images/ray-triangle-intersection.png

  • Exploit condition \(\alpha+\beta+\gamma=1\) to eleminate \(\alpha\) \[ \vec{o} + t\,\vec{d} \;=\; (1-\beta-\gamma)\vec{A} + \beta\vec{B} + \gamma\vec{C}\]
    Solve \(3 \times 3\) linear system (Cramer’s rule)

  • Check inside conditions: \(0 \leq \alpha, \beta, \gamma \leq 1\)

Lighting

images/ray-tracing-pipeline-3.svg images/ray-tracing.svg

images/spheres-0.pngno illumination images/spheres-2.pnglocal illumination images/spheres-4.pngglobal illumination

Phong Lighting Model

images/torus-a.pngambient: \(I_a m_a\) images/torus-d.pngdiffuse: \(I_l m_d \left( \vec{n} \cdot \vec{l} \right)\) images/torus-s.pngspecular: \(I_l m_s \left( \vec{r} \cdot \vec{v} \right)^s\)

images/torus-ads.png \[ I \;=\; I_a m_a + I_l \left( m_d \left( \vec{n} \cdot \vec{l} \right) + m_s \left( \vec{r} \cdot \vec{v} \right)^s \right) \]

Shadows

  • Send shadow ray from intersection point to light source.
  • Discard diffuse and specular contribution if light source is blocked by another object.
images/lighting-shadow-1.svg
Point in light: ambient + diffuse + specular
images/lighting-shadow-2.svg
Point In shadow: ambient lighting only

Recursive Ray Tracing

  • At each intersection point, reflect and/or refract incoming viewing ray at surface normal, and trace child rays recursively.

  • The final color is interpolated between local illumination, reflection, and refraction based on material properties.

images/ray-tracing.svg

Spatial Data Structures for Meshes

  • Brute-Force
    • Intersect ray with all \(n\) triangles of the mesh
    • Select intersection with smallest positive ray parameter \(t\)
    • Computational cost: \(\mathcal{O}(n)\)
  • Bounding Volumes
    • Bound mesh by simple-to-interesect objects (sphere, box, etc.)
    • Only if ray intersects bounding volume, then test individual triangles
    • Bounding volume hierarchy leads to \(\mathcal{O}(\log n)\)
  • Spatial Hierarchy
    • Partition scene into a spatial hierarchy
    • Grid, Octree, kD-tree, BSP-tree
    • Spatial hierarchy leads to \(\mathcal{O}(\log n)\)

Limits of Raytracing

images/cbox-0.pngstandard ray tracing images/cbox-1.png+soft shadows images/cbox-2.png+caustics images/cbox-3.png+indirect lighting

© Henrik Wann Jensen

Light Paths

images/light-paths.svg

  • E = eye point
  • L = light source
  • D = diffuse reflection
  • S = specular reflection

Ray Tracing vs. Rasterization

  • Ray Tracing
    • Shoot rays from 2D pixels into 3D scene
    • “backward rendering”
    • needs ray intersections
images/raytracing-vs-rasterization-1.svg
  • Rasterization
    • Project 3D objects onto 2D image plane
    • “forward rendering”
    • needs transformations, projections, visibility computation
images/raytracing-vs-rasterization-2.svg

Rasterization Pipeline

images/rendering-pipeline.svg

Transformations & Projections

images/rendering-pipeline-1.svg

images/trafo-scaling.svgscaling images/trafo-rotation.svgrotation images/trafo-translation.svgtranslation

Transformations & Projections

images/rendering-pipeline-1.svg

  • Linear and affine transformations
  • Homogenous coordinates
  • Matrix representation

Transformations & Projections

images/rendering-pipeline-1.svg

images/ortho-projection.png images/frustum-1.png

Transformations & Projections

images/rendering-pipeline-1.svg

  • Types of projections
  • Derivation of perspective projections
  • Coordinate systems and matrix representation

Lighting

images/rendering-pipeline-2.svg

Phong Lighting Model

images/spheres-0.pngambient images/spheres-1.png+diffuse images/spheres-2.png+specular

Clipping

images/rendering-pipeline-3.svg

images/clipping.svg

Rasterization

images/rendering-pipeline-4.svg

images/rasterization.gif

Rasterization

images/rendering-pipeline-4.svg

  • Bresenham Algorithm
    • implicit vs explicit representation
    • integer arithmetic

Shading

images/rendering-pipeline-5.svg

images/teapot-flat.pngflat images/teapot-gouraud.pngGouraud images/teapot-phong.pngPhong

Visibility

images/rendering-pipeline-6.svg

images/z-buffer.jpg images/z-buffer.svg z-Buffer

Visibility

images/rendering-pipeline-6.svg

  • Painters algorithm vs. z-buffer
  • Potential issues of z-buffer

Texture

  • Texturing a single triangle
  • Texturing a triangle mesh
  • Texture filtering
  • Special texture maps

Shadow Mapping

  • Exploit visibility computation of z-buffer algorithm
  • Multi-pass rendering
  • Pros and cons of shadow mapping
  • Artifacts and potential solutions

L-System

  • An L-system is a string rewriting system (semi-Thue grammar) invented by Aristid Lindenmayer (1968).
  • L-System \(\mathbf{G} = (V, \omega, P)\)
    • Grammar on an alphabet of symbols, V, such as “F”, “+”, “-”.
    • Production rules \(P\) describe the replacement of a nonterminal symbol with a string of zero or more symbols.
    • Process is seeded with an axiom \(\omega\), an initial string

Forward Problem

  • Which L-System rule produces the following output given axiom F at level 5 and angle 90?
  1. \(F \rightarrow F-F+F\)
  2. \(F \rightarrow F+FF\)
  3. \(F \rightarrow FFF+FF\)
images/quiz2.png

Inverse Problem

  • Which L-System creates this output?
    • define the axiom and the rule(s)

images/grid0.pnglevel 0 = axiom images/grid1.pnglevel 1 images/grid2.pnglevel 2 images/grid3.pnglevel 3

Extensions

  • Branching
  • Stochastic L-Systems
  • 3D L-Systems

Procedural Methods

  • Value noise vs. Perlin noise
  • Spectral synthesis
  • Fractal Brownian Motion
  • Fractal Dimension
  • Terrain Modeling

Bezier Curves

  • Parametric Representation
  • Polynomial curves
  • Requirements for modeling
  • Bernstein Polynomials
    • Properties and implications for Bezier curve
  • de Casteljau algorithm
  • connecting Bezier curves
  • extension to tensor-product surface

Learning Outcomes

  • After attending the course you should be able to
    • explain and apply the fundamental mathematical concepts of computer-based image synthesis
    • implement a basic raytracing algorithm in C++
    • develop basic graphics programs in OpenGL using shader programming
    • design and implement geometry synthesis methods based on procedural techniques
    • coordinate a team during a software project

Advanced Courses

  • 3D Geometry Processing - Master, Spring

  • Applied Optimization - Master, Fall

Thank You! Merry Christmas!