Advanced Computer Graphics Last Ray Tracing; Antialiasing David Luebke cs551dl@cs.virginia.edu http://www.cs.virginia.edu/~cs551dl David Luebke 7/27/2016 Administrivia Read Chapter 4 Hand back Exercise 1 Go over it (Dale) Hand out Assignment 1 David Luebke 7/27/2016 Recap Speedup Techniques – Intersect rays faster Bounding volumes Spatial partitions Reordering ray intersection tests Optimizing intersection tests – Shoot fewer rays – Shoot “smarter” rays David Luebke 7/27/2016 Optimizing Ray Intersection Tests Fine-tune the math! – Share subexpressions – Precompute everything possible Code with care – Even use assembly, if necessary – Will get its own lecture David Luebke 7/27/2016 Speedup Techniques Speedup Techniques – Intersect rays faster – Shoot fewer rays – Shoot “smarter” rays David Luebke 7/27/2016 Shoot Fewer Rays Adaptive depth control – Naïve ray tracer: spawn 2 rays per intersection until max recursion limit – In practice, few surfaces are transparent or reflective Contribution of most rays to image: 0% Don’t shoot rays w/ contribution near 0% David Luebke 7/27/2016 Shoot Fewer Rays Adaptive sampling – Shoot rays coarsely, interpolating their values across pixels – Where adjacent rays differ greatly in value, sample more finely – Stop when some maximum resolution is reached Show example David Luebke 7/27/2016 Antialiasing Aliasing: signal processing term with very specific meaning Aliasing: computer graphics term for any unwanted visual artifact Antialiasing: computer graphics term for avoiding unwanted artifacts We’ll tackle these in order David Luebke 7/27/2016 Signal Processing Raster display: regular sampling of a continuous function (Really?) Think about sampling a 1-D function: David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: – What do you notice? David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: what do you notice? – Jagged, not smooth David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: what do you notice? – Jagged, not smooth – Loses information! David Luebke 7/27/2016 Signal Processing Sampling a 1-D function: what do you notice? – Jagged, not smooth – Loses information! What can we do about these? – Use higher-order reconstruction – Use more samples – How many more samples? David Luebke 7/27/2016 The Sampling Theorem Obviously, the more samples we take the better those samples approximate the original function The sampling theorem: A continuous bandlimited function can be completely represented by a set of equally spaced samples, if the samples occur at more than twice the frequency of the highest frequency component of the function David Luebke 7/27/2016 The Sampling Theorem In other words, to adequately capture a function with maximum frequency F, we need to sample it at frequency N = 2F. N is called the Nyquist limit. David Luebke 7/27/2016 The Sampling Theorem An example: sinusoids David Luebke 7/27/2016 The Sampling Theorem An example: sinusoids David Luebke 7/27/2016 The Sampling Theorem Show Figure 4.2 in the book (p. 113) David Luebke 7/27/2016 Fourier Theory All our examples have been sinusoids Does this help with real world signals? Why? Fourier theory lets us decompose any signal into the sum of (a possibly infinite number of) sine waves David Luebke 7/27/2016 Fourier Theory: The Ugly Stuff Next comes the math… Read Chapter 4 David Luebke 7/27/2016