cs 551/651: advanced computer graphics
DESCRIPTION
CS 551/651: Advanced Computer Graphics. Advanced Ray Tracing Radiosity. Administrivia. Quiz 1: Tuesday, Feb 20 Yes, I’ll have your homework graded by then (somehow) Normal written exam (oral later). Recap: Distributed Ray Tracing. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/1.jpg)
David Luebke 1 04/19/23
CS 551/651: Advanced Computer Graphics
Advanced Ray Tracing
Radiosity
![Page 2: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/2.jpg)
David Luebke 2 04/19/23
Administrivia
Quiz 1: Tuesday, Feb 20 Yes, I’ll have your homework graded by then
(somehow) Normal written exam (oral later)
![Page 3: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/3.jpg)
David Luebke 3 04/19/23
Recap: Distributed Ray Tracing
Distributed ray tracing: an elegant stochastic approach that distributes rays across: Pixel for antialiasing Light source for soft shadows Reflection function for soft (glossy) reflections Time for motion blur Lens elements for depth of field
Cook: 16 rays suffice for all of these
![Page 4: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/4.jpg)
David Luebke 4 04/19/23
Recap: Backwards Ray Tracing
Two-pass algorithm: Rays are cast from light into scene Rays are cast from the eye into scene, picking up
illumination showered on the scene in the first pass Backwards ray tracing can capture:
Indirect illumination Color bleeding Caustics
![Page 5: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/5.jpg)
David Luebke 5 04/19/23
Recap: 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
![Page 6: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/6.jpg)
David Luebke 6 04/19/23
Recap: Radiosity
Ray tracing: Models specular reflection easily Diffuse lighting is more difficult View-dependent, generates a picture
Radiosity methods explicitly model light as an energy-transfer problem Models diffuse interreflection easily But only diffuse; no shiny (specular) surfaces View-independent, generates a 3-D model
![Page 7: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/7.jpg)
David Luebke 7 04/19/23
Recap: Radiosity
Basic idea: represent surfaces in environment as many discrete patches A patch, or element, is a polygon over which light
intensity is constant Model light transfer between patches as a system
of linear equations Solve this system for the intensity at each patch Solve for R,G,B intensities; get color at each patch Render patches as colored polygons in OpenGL
![Page 8: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/8.jpg)
David Luebke 8 04/19/23
Recap: Fundamentals
Definition: 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
Simplifying assumptions Environment is closed All surfaces have Lambertian reflectance Surface patches emit and reflect light uniformly over
their entire surface
![Page 9: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/9.jpg)
David Luebke 9 04/19/23
Radiosity
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
![Page 10: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/10.jpg)
David Luebke 10 04/19/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
We’ll return later to the calculation of form factors
![Page 11: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/11.jpg)
David Luebke 11 04/19/23
Form Factors
Some examples…
Form factor: nearly 100%
![Page 12: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/12.jpg)
David Luebke 12 04/19/23
Form Factors
Some examples…
Form factor: roughly 50%
![Page 13: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/13.jpg)
David Luebke 13 04/19/23
Form Factors
Some examples…
Form factor: roughly 10%
![Page 14: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/14.jpg)
David Luebke 14 04/19/23
Form Factors
Some examples…
Form factor: roughly 5%
![Page 15: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/15.jpg)
David Luebke 15 04/19/23
Form Factors
Some examples…
Form factor: roughly 30%
![Page 16: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/16.jpg)
David Luebke 16 04/19/23
Form Factors
Some examples…
Form factor: roughly 2%
![Page 17: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/17.jpg)
David Luebke 17 04/19/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
![Page 18: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/18.jpg)
David Luebke 18 04/19/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
![Page 19: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/19.jpg)
David Luebke 19 04/19/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!
![Page 20: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/20.jpg)
David Luebke 20 04/19/23
Radiosity
Now “just” need to solve the matrix! W&W: matrix is “diagonally dominant” Thus Guass-Siedel must converge (what’s that?)
End result: radiosities for all patches Solve RGB radiosities separately, color each
patch, and render! Caveat: for rendering, we actually color
vertices, not patches (see F&vD p 795)
![Page 21: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/21.jpg)
David Luebke 21 04/19/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
![Page 22: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/22.jpg)
David Luebke 22 04/19/23
Roadmap
So, we know the basic radiosity algorithm Represent light transfer as a matrix Solve the matrix to get radiosity (=color) per patch
Next topics: Evaluating form factors Progressive radiosity: viewing an approximate
solution early Hierarchical radiosity: increasing patch resolution
on an as-needed basis
![Page 23: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/23.jpg)
David Luebke 23 04/19/23
Form Factors
Calculating form factors is hard Analytic form factor between two polygons in
general case: open problem till last few years Q: So how might we go about it? Hint: Clearly form factors are related to
visibility: how much of patch j can patch i “see”?
![Page 24: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/24.jpg)
David Luebke 24 04/19/23
Form Factors: Hemicube
Hemicube algorithm: Think Z-buffer Render the model onto a hemicube as seen from the center of patch
i Store item IDs instead of color Use Z-buffer to resolve visibility See W&W p 278
Q: Why hemicube, not hemisphere?
![Page 25: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/25.jpg)
David Luebke 25 04/19/23
Form Factors: Hemicubes
Advantages of hemicubes Solves shape, size, orientation, and occlusion
problems in one framework Can use hardware Z-buffers to speed up form
factor determination (How?)
![Page 26: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/26.jpg)
David Luebke 26 04/19/23
Form Factors: Hemicubes
Q: What are some disadvantages of hemicubes? Aliasing! Low resolution buffer can’t capture
actual polygon contributions very exactly Causes “banding” near lights (plate 41)
Actual form factor is over area of patch; hemicube samples visibility at only center point on patch (So?)
![Page 27: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/27.jpg)
David Luebke 27 04/19/23
Form Factors: Ray Casting
Idea: shoot rays from center of patch in hemispherical pattern
![Page 28: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/28.jpg)
David Luebke 28 04/19/23
Form Factors: Ray Casting
Advantages: Hemisphere better approximation than hemicube
More even sampling reduces aliasing Don’t need to keep item buffer Slightly simpler to calculate coverage
![Page 29: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/29.jpg)
David Luebke 29 04/19/23
Form Factors: Ray Casting
Disadvantages: Regular sampling still invites aliasing Visibility at patch center still isn’t quite the same
as form factor Ray tracing is generally slower than
Z-buffer-like hemicube algorithms Depends on scene, though Q: What kind of scene might ray tracing actually be
faster on?
![Page 30: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/30.jpg)
David Luebke 30 04/19/23
Form Factors
Source-to-vertex form factors Calculating form factors at the patch vertices
helps address some problems:for every patch vertex
for every source patch
sample source evenly with rays
visibility = % rays that hit Q: What are the problems with this
approach?
![Page 31: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/31.jpg)
David Luebke 31 04/19/23
Form Factors
Summary of form factor computation Analytical:
Expensive or impossible (in general case) Hemicube
Fast, especially using graphics hardware Not very accurate; aliasing problems
Ray casting Conceptually cleaner than hemicube Usually slower; aliasing still possible
![Page 32: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/32.jpg)
David Luebke 32 04/19/23
Substructuring
More patches better results Problem: # form factors grows quadratically
with # patches Substructuring: adaptively subdivide patches
into elements where high radiosity gradient is found
![Page 33: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/33.jpg)
David Luebke 33 04/19/23
Substructuring
Elements are second-class patches: When a patch is subdivided, form factors are
computed from the elements to other patches But form factors from the other patches to the
elements are not computed However, the form factors from other patches to the
subdivided patch are updated using more accurate area-weighted average of elements
![Page 34: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/34.jpg)
David Luebke 34 04/19/23
Substructuring
Elements vs. patches, cont. Elements “gather” radiosity from other patches But those other patches only gather radiosity from
the “parent” patch, not the individual elements So an element’s contribution to other patches is
approximated coarsely by it’s patch’s radiosity
![Page 35: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/35.jpg)
David Luebke 35 04/19/23
Substructuring
Bottom line: Substructuring allows subpatch radiosities to be
computed without changing the size of the form-factor matrix
Show examples: W&W plate 38, F&vD plate III.21
Note: texts aren’t clear about adaptive subdivision vs substructuring
![Page 36: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/36.jpg)
David Luebke 36 04/19/23
Progressive Radiosity
Good news: iterative solver of radiosity matrix will converge
Bad news: can take a long time Progressive radiosity: reorder computation to
allow viewing of partial results
![Page 37: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/37.jpg)
David Luebke 37 04/19/23
Progressive Radiosity
Radiosity as described uses Gauss-Seidel iterative solver Must do an entire iteration to get an estimate of
patch radiosities Must precompute and store all O(n2) form factors
![Page 38: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/38.jpg)
David Luebke 38 04/19/23
Progressive Radiosity
1 - 1F11 - 1F12 … - 1F1n B1 E1
- 2F21 1 - 2F22 … - 2F2n B2 E2
. . … . . .
. . … . . .
. . … . . .
- pnFn1 - nFn2 … 1 - nFnn Bn En
Evaluating row i estimates radiosity of patch i based on all other patches
We say the patch gathers light from the environment
![Page 39: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/39.jpg)
David Luebke 39 04/19/23
Progressive Radiosity
Progressive radiosity shoots light from a patch into the environment:
Bj due to Bi = j Bj Fji j rather than
Bi due to Bj = i Bj Fij j Given an estimate of Bi, evaluating this
equation estimates patch i’s contribution to the rest of the scene
![Page 40: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/40.jpg)
David Luebke 40 04/19/23
Progressive Radiosity
A problem: evaluating the equation
Bj due to Bi = j Bj Fji j requires knowing Fji for each patch j
Determining these values requires a hemicube computation per patch
Use reciprocity relationship to get
Bj due to Bi = j Bj Fij (Ai/Aj) j
![Page 41: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/41.jpg)
David Luebke 41 04/19/23
Progressive Radiosity
Now evaluation requires only a single hemicube about patch i Compute, use, and discard form factors Drastically reduces total storage!
Reorder radiosity computation: Pick patch w/ highest estimated radiosity
Shoot to all other patches Update their estimates
Pick new “brightest” patch and repeat
![Page 42: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/42.jpg)
David Luebke 42 04/19/23
Progressive Radiosity
We can look at the scene after every iteration through this loop
Q: How will it look after 1 loop? Q: 2 loops? Q: If m = # of light sources, how will it
look after m loops? After 2m loops?
![Page 43: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/43.jpg)
David Luebke 43 04/19/23
Progressive Radiosity
Subtleties: Pick patch with most energy to shoot
Energy = radiosity * area = Bj Ai
A patch may be selected to shoot again after new light has been shot to it
So don’t shoot Bj , shoot Bj, the amount of radiosity patch i has received since it was last shot
![Page 44: CS 551/651: Advanced Computer Graphics](https://reader036.vdocuments.us/reader036/viewer/2022081515/56812dd5550346895d932166/html5/thumbnails/44.jpg)
David Luebke 44 04/19/23
The End