![Page 1: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/1.jpg)
CS 563 Advanced Topics in Computer Graphics
Russian Roulette - Sampling Reflectance Functions
by Alex White
![Page 2: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/2.jpg)
Monte Carlo Ray Tracing
§ Monte Carlo§ In ray tracing, use randomness to evaluate higher
dimensional integrals§ But while correct on the average, a variance is induced
§ Variance leads to a noisy image
§ Convergence rate: quadruple samples to reduce variance by half
§ Goal: Improve efficiency without increasing samples
![Page 3: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/3.jpg)
What is efficiency?
§ For an estimator F :
§ V[F] = its variance§ T[F] = running time to compute the value
][][1
][FTFV
F×
=∈
![Page 4: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/4.jpg)
Russian Roulette
§ Improve efficiency by increasing likelihood that sample will have a significant contribution§ Spend less time on small contributions
![Page 5: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/5.jpg)
Russian Roulette
§ Direct lighting integral
§ Estimator for N samples
§ Most of the work comes from tracing a shadow ray§ How to optimize?
( ) ( )( )∑
=
N
i i
iiidior
pdpLpf
N 1
cos,,,1ω
ωθωωω
iiidioS roo dwpLpfpL θωωωω cos),(),,(),(2∫=
![Page 6: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/6.jpg)
Russian Roulette
§ If is zero for the direction we can skip the tracing work§ Why stop there?§ What about rays where this value is very
small?§ Or when is close to the horizon?
§ We can’t ignore or we would underestimate the end result§ Answer: weighting!
( )ior pf ωω ,, iω
iω
![Page 7: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/7.jpg)
Russian Roulette
§ However, this never reduces variance
§ Imagine a bunch of black pixels with a few very bright ones
§ A technique known as “efficiency-optimized Russian roulette” attempts to rectify this§ Keep track of average variance and average ray
count§ Use to compute threshold for each new sample
![Page 8: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/8.jpg)
Battle of the Roulettes -Thiago Ize, University of Utah
Full scene – efficiency-optimized Russian roulette (10.5m)
![Page 9: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/9.jpg)
Battle of the RoulettesFixed Max Depth of 100 (53.2m)
![Page 10: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/10.jpg)
Battle of the RoulettesFixed Max Depth of 10 (10.6m)
![Page 11: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/11.jpg)
Battle of the RoulettesRussian roulette (30%
termination)
![Page 12: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/12.jpg)
Battle of the RoulettesRussian roulette (q proportional to
“pathThroughput/0.5 (27.8m))
![Page 13: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/13.jpg)
Battle of the RoulettesRussian roulette (q proportional to
“pathThroughput/0.1” (31.3m))
![Page 14: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/14.jpg)
Battle of the RoulettesRussian roulette (q proportional to
“pathThroughput/0.01” (32.6m))
![Page 15: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/15.jpg)
Battle of the RoulettesEfficiency-optimized Russian
roulette (28.8m)
![Page 16: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/16.jpg)
Battle of the RoulettesRussian roulette (q proportional to
“pathThroughput/0.5 (27.8m))
![Page 17: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/17.jpg)
Splitting
§ Russian roulette – reduces effort spent evaluating unimportant samples
§ Splitting – increases important samples to improve efficiency§ Each sample = 1 camera ray + 1 shadow ray§ Important means shadow rays in many cases
![Page 18: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/18.jpg)
Careful Sample Placement -Stratified Sampling Revisited
§ Divide a domain into non-overlapping regions
§ Stratified sampling can never increase variance§ Large strata contain more variation and will have
individual means closer to the real mean
§ Why not keep making strata smaller?§ “Curse of dimensionality”§ Possible to stratify some dimensions independently§ Latin Hypercube sampling
![Page 19: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/19.jpg)
Random SamplingFigure 15.02a
![Page 20: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/20.jpg)
Stratified SamplingFigure 15.02b
![Page 21: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/21.jpg)
Quasi Monte Carlo
§ Replace random numbers with low-discrepancy point sets generated by carefully designed deterministic algorithms§ Advantage: faster rates of convergence
§ Works better with a smooth integrand not characteristic of graphics§ performs slightly better in practice
§ Works better with smaller dimensions§ A hybrid technique “randomized quasi-Monte
Carlo” extends the benefits to larger dimensions
![Page 22: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/22.jpg)
Warping Samples
§ Sample points lie within [0,1]2
§ PBRT uses algorithms to transform to map to light sources§ Mapping must preserve benefits of
stratification
§ (0,2)-sequence still well distributed§ Random stratified is not
![Page 23: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/23.jpg)
Bias
§ Sometimes, picking an estimator whose expected value does NOT equal the actual, can lead to lower variance§ Bias ( ):
§ How can this be good?
FFE −= ][β
β
![Page 24: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/24.jpg)
Importance Sampling
§ Importance sampling§ Choose a sampling distribution that is similar in
shape to the integrand§ Samples tend to be taken from “important” parts
where the value is higher
§ One of the most frequently use variation reduction techniques § It’s not difficult to fine an appropriate distribution
in graphics§ Often integrand a product of more than one function§ Finding one similar to one multiplicand is easier§ However a bad choice can be worse than uniform
![Page 25: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/25.jpg)
Multiple Importance Sampling
§ But often we can find one similar to multiple terms§ Which one do we use?
![Page 26: CS 563 Advanced Topics in Computer Graphics …web.cs.wpi.edu/~emmanuel/courses/cs563/S07/talks/alex...“pathThroughput/0.01” (32.6m)) Battle of the Roulettes Efficiency-optimized](https://reader034.vdocument.in/reader034/viewer/2022042408/5f236e3a7f8ff01ab43dc6d9/html5/thumbnails/26.jpg)
References
§ Physically Based Rendering. Pharr and Humphreys.§ “Efficiency-Optimized Russian Roulette.”
Thiago Ize, University of Utah. http://www.cs.utah.edu/~thiago/cs7650/hw12/index.html.§ “Quasi-Monte Carlo method.” Wikipedia.
http://en.wikipedia.org/wiki/Quasi-Monte_Carlo_method