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