david luebke 1 12/2/2015 cs 551/651: advanced computer graphics advanced ray tracing radiosity
TRANSCRIPT
David Luebke 1 04/21/23
CS 551/651: Advanced Computer Graphics
Advanced Ray Tracing
Radiosity
David Luebke 2 04/21/23
Administrivia
My penance: Ray tracing homeworks very slow to grade Many people didn’t include READMEs Many (most) people didn’t include
workspace/project files or Makefiles Some people’s don’t work Nobody’s works perfectly
Quiz 1: Tuesday, Feb 20
David Luebke 3 04/21/23
Recap: Stochastic Sampling
Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias
Q: What about irregular sampling? A: High frequencies appear as noise, not
aliases This turns out to bother our visual system less!
David Luebke 4 04/21/23
Recap: Stochastic Sampling
Poisson distribution: Completely random Add points at random until area is full. Uniform distribution: some neighboring samples
close together, some distant
David Luebke 5 04/21/23
Recap: Stochastic Sampling
Poisson disc distribution: Poisson distribution, with minimum-distance
constraint between samples Add points at random, removing again if they are
too close to any previous points Jittered distribution
Start with regular grid of samples Perturb each sample slightly in a random direction More “clumpy” or granular in appearance
David Luebke 6 04/21/23
Recap: Stochastic Sampling
Spectral characteristics of these distributions: Poisson: completely uniform (white noise). High
and low frequencies equally present Poisson disc: Pulse at origin (DC component of
image), surrounded by empty ring (no low frequencies), surrounded by white noise
Jitter: Approximates Poisson disc spectrum, but with a smaller empty disc.
David Luebke 7 04/21/23
Recap: Nonuniform Supersampling
To be correct, need to modify filtering step:
David Luebke 8 04/21/23
Recap: Nonuniform Supersampling
Approximate answer: weighted average filter
Correct answer: multistage filtering Real-world answer: ignore the problem
I(i, j) h(x-i, y-j) h(x-i, y-j)I’(x,y) =
David Luebke 9 04/21/23
Recap: Antialiasing and Texture Mapping
Texture mapping is uniquely harder Potential for infinite frequencies
Texture mapping is uniquely easier Textures can be prefiltered
David Luebke 10 04/21/23
Recap: Antialiasing and Texture Mapping
Issue in prefiltering texture is how much texture a pixel filter covers
Simplest prefiltering scheme: MIP-mapping Idea: approximate filter size, ignore filter shape Create a pyramid of texture maps Each level doubles filter size
David Luebke 11 04/21/23
Recap: Mip-Mapping
Tri-linear mip-mapping Pixel size depth d Linearly interpolate colors within 2 levels
closest to d Linearly interpolate color between levels
according to d
David Luebke 12 04/21/23
Distributed Ray Tracing
Distributed ray tracing is an elegant technique that tackles many problems at once Stochastic ray tracing: distribute rays
stochastically across pixel Distributed ray tracing: distribute rays
stochastically across everything
David Luebke 13 04/21/23
Distributed Ray Tracing
Distribute rays stochastically across: Pixel for antialiasing Light source for soft shadows Reflection function for soft (glossy) reflections Time for motion blur Lens for depth of field
Cook: 16 rays suffice for all of these I done told you wrong: 4x4, not 8x8
David Luebke 14 04/21/23
Distributed Ray Tracing
Distributed ray tracing is basically a Monte Carlo estimation technique
Practical details: Use lookup tables (LUTs) for distributing rays
across functions See W&W Figure 10.14 p 263
David Luebke 15 04/21/23
Backwards Ray Tracing
Traditional ray tracing traces rays from the eye, through the pixel, off of objects, to the light source
Backwards ray tracing traces rays from the light source, into the scene, into the eye
Why might this be better?
David Luebke 16 04/21/23
Backwards Ray Tracing
Backwards ray tracing can capture: Indirect illumination Color bleeding Caustics
Remember what a caustic is? Give some examples Remember where caustics get the name?
David Luebke 17 04/21/23
Backwards Ray Tracing
Usually implies two passes: Rays are cast from light into scene Rays are cast from the eye into scene, picking up
illumination showered on the scene from the first pass
David Luebke 18 04/21/23
Backwards Ray Tracing
Q: How might these two passes “meet in the middle?”
David Luebke 19 04/21/23
Backwards Ray Tracing
Arvo: illumination maps tile surfaces with regular grids, like texture maps Shoot rays outward from lights Every ray hit deposits some of its energy into
surface’s illumination map Ignore first generation hits that directly illuminate
surface (Why?) Eye rays look up indirect illumination using
bilinear interpolation
David Luebke 20 04/21/23
Backwards Ray Tracing
Watt & Watt, Plate 34 Illustrates Arvo’s method of backwards ray tracing
using illumination maps Illustrates a scene with caustics
Related idea: photon maps
David Luebke 21 04/21/23
Advanced Ray Tracing Wrapup
Backwards ray tracing accounts for indirect illumination by considering more general paths from light to eye
Distributed ray tracing uses a Monte Carlo sampling approach to solve many ray-tracing aliasing problems
David Luebke 22 04/21/23
Next Up: Radiosity
Ray tracing: Models specular reflection easily Diffuse lighting is more difficult
Radiosity methods explicitly model light as an energy-transfer problem Models diffuse interreflection easily Shiny, specular surfaces more difficult
David Luebke 23 04/21/23
Radiosity Introduction
First lighting model: Phong Still used in interactive graphics Major shortcoming: local illumination!
After Phong, two major approaches: Ray tracing Radiosity
David Luebke 24 04/21/23
Radiosity Introduction
Ray tracing: ad hoc approach to simulating optics Deals well with specular reflection Trouble with diffuse illumination
Radiosity: theoretically rigorous simulation of light transfer Very realistic images But makes simplifying assumption: only diffuse
interaction!
David Luebke 25 04/21/23
Radiosity Introduction
Ray-tracing: Computes a view-dependent solution End result: a picture
Radiosity: Models only diffuse interaction, so can compute a
view-independent solution End result: a 3-D model
David Luebke 26 04/21/23
Radiosity
Basic idea: represent surfaces in environment as many discrete patches
A patch, or element, is a polygon over which light intensity is constant
David Luebke 27 04/21/23
Radiosity
Model light transfer between patches as a system of linear equations
Solving this system gives the intensity at each patch
Solve for R, G, B intensities and get color at each patch
Render patches as colored polygons in OpenGL. Voila!
David Luebke 28 04/21/23
Fundamentals
Theoretical foundation: heat transfer Need system of equations that describes
surface interreflections Simplifying assumptions:
Environment is closed All surfaces are Lambertian reflectors
David Luebke 29 04/21/23
Radiosity
The radiosity of a surface is the rate at which energy leaves the surface
Radiosity = rate at which the surface emits energy + rate at which the surface reflects energy Notice: previous methods distinguish light sources
from surfaces In radiosity all surfaces can emit light Thus: all emitters inherently have area
David Luebke 30 04/21/23
Radiosity
Break environment up into a finite number n of discrete patches Patches are opaque Lambertian surfaces of finite
size Patches emit and reflect light uniformly over their
entire surface Q: What’s wrong with this model? Q: What can we do about it?
David Luebke 31 04/21/23
Radiosity
Then for each surface i:
Bi = Ei + i Bj Fji (Aj / Ai)
where
Bi, Bj= radiosity of patch i, j
Ai, Aj= area of patch i, j
Ei = energy/area/time emitted by i
i = reflectivity of patch i
Fji = Form factor from j to i
David Luebke 32 04/21/23
Form Factors
Form factor: fraction of energy leaving the entirety of patch i that arrives at patch j, accounting for: The shape of both patches The relative orientation of both patches Occlusion by other patches
David Luebke 33 04/21/23
Form Factors
Some examples…
Form factor: nearly 100%
David Luebke 34 04/21/23
Form Factors
Some examples…
Form factor: roughly 50%
David Luebke 35 04/21/23
Form Factors
Some examples…
Form factor: roughly 10%
David Luebke 36 04/21/23
Form Factors
Some examples…
Form factor: roughly 5%
David Luebke 37 04/21/23
Form Factors
Some examples…
Form factor: roughly 30%
David Luebke 38 04/21/23
Form Factors
Some examples…
Form factor: roughly 2%
David Luebke 39 04/21/23
Form Factors
In diffuse environments, form factors obey a simple reciprocity relationship:
Ai Fij = Ai Fji
Which simplifies our equation:
Bi = Ei + i Bj Fij
Rearranging to:
Bi - i Bj Fij = Ei
David Luebke 40 04/21/23
Form Factors
So…light exchange between all patches becomes a matrix:
What do the various terms mean?
nnnnnnnnn
n
n
E
E
E
B
B
B
FFF
FFF
FFF
2
1
2
1
21
22222212
11121111
1
1
1
David Luebke 41 04/21/23
Form Factors
1 - 1F11 - 1F12 … - 1F1n B1 E1
- 2F21 1 - 2F22 … - 2F2n B2 E2
. . … . . .
. . … . . .
. . … . . .
- pnFn1 - nFn2 … 1 - nFnn Bn En
Note: Ei values zero except at emitters Note: Fii is zero for convex or planar patches Note: sum of form factors in any row = 1 (Why?) Note: n equations, n unknowns!
David Luebke 42 04/21/23
Radiosity
Now “just” need to solve the matrix! W&W: matrix is “diagonally dominant” Thus Guass-Siedel must converge
End result: radiosities for all patches Solve RGB radiosities separately, color each
patch, and render! Caveat: actually, color vertices, not patches
(see F&vD p 795)
David Luebke 43 04/21/23
Radiosity
Q: How many form factors must be computed? A: O(n2) Q: What primarily limits the accuracy of the
solution? A: The number of patches
David Luebke 44 04/21/23
Radiosity
Where we go from here: Evaluating form factors Progressive radiosity: viewing an approximate
solution early Hierarchical radiosity: increasing patch resolution
on an as-needed basis
David Luebke 45 04/21/23
The End