CS 130 Anti-aliasing Images and Aliasing Aliasing errors caused by rasterizing How to correct them, in general 2 1
Aliased Lines Stair stepping and jaggies 3 Remove the jaggies Anti-aliased Lines 4 2
Aliasing Caused by high frequency information parading as low frequency 7 Aliasing Caused by high frequency information parading as low frequency 8 3
Aliasing Sampling Theory - Nyquist Limit - Nyquist Rate - a signal can be properly reconstructed from samples if sampled at a frequency that is greater than twice the frequency of the highest freq. in the signal spectrum 9 Aliasing in images 10 4
Aliasing Sub-sampling Sampling at pixel centers Luminosity trace 11 Aliasing Sub-sampling Rendered Image Luminosity trace 12 5
Aliasing Sub-sampling Original model Loss of detail Rendered Image 13 Aliasing What can be done? When generating CG images, we have a fair amount of control and we have options Techniques correct errors, called Anti-Aliasing such as: - Super-sampling - Filtering - Jittering 14 6
Filtering Original model Rendered Image Filtering methods examine areas of a color within a pixel 17 e.g. Gaussian blur Filtering 18 7
Super-sampling Multiple samples / pixel 19 Non-uniform filtering Weighted filtering Combine nine samples Filtering combines samples to find color within a pixel 20 8
Weighted filtering Filtering combines samples to find color within a pixel 21 Super-sampling with jittering Randomize sampling within grid Jittered samples 22 9
Example 23 Example 24 10
Example 25 Example 26 11
Advanced Rendering 27 Global Rendering: -Radiosity -Photon Mapping Non-photorealistic Rendering 12
Can you get this w/simple ray tracing? 29 Radiosity 30 13
Radiosity Physically based model for light interaction Accounts for indirect illumination - Color bleeding - Soft shadows 31 What is Radiosity? It is the name of a measure of light energy......and an algorithm: - Radiant Energy (flux) = energy flow per unit time (Watt) - Radiosity = flux per unit area (a derivative of flux with respect to area) radiated from a surface. - These are wavelength-dependent quantities. 32 14
Global Rendering Light strikes A - Some scattered - Some absorbed Some of scattered light strikes B - Some scattered - Some absorbed Some scattered light strikes A and so on 33 Discretizing the Rendering Equation Assume perfectly diffuse surfaces Discretize space into patches Color is constant per patch, for now 36 15
Solving for Radiosity Assume polygonal scene - polygons divided into n small patches - patch i has area A i - radiosity B i - Emits energy E i - Has surface reflectance r i (diffuse reflection) Models lighting in scenes for diffusely reflecting surfaces only. 37 Basic Equation Energy (i) = Emitted Energy (i) + Reflected Energy (i) i = 1,2,,n Reflected Energy(i) = r i * (Total Energy from Environment) Total Energy (i) = Sum of proportions of energy from all other objects that reach i n j 1 B F j ji where F ji = proportion of energy from j that reaches i per unit area of j (F is form-factor) 38 16
Form Factors N ai dai N aj r Patch i to patch j dai F dai da j = cosa i cos r 2 a j approximate Form-factor 39 Basic Equation Can write as system of n linear equations in n unknowns. FB = E B's are the unknown Assume all else is known One set of eqns for each wavelength! 40 17
The Radiosity Equation FB = E B 1 E 1 where B B 2 = and E = ¼ B n E 2 ¼ E n 1 r 1 F 11 r 1 F 12 ¼ r 1 F 1n and F = r 2 F 21 1 r 2 F 22 ¼ r 2 F 2n ¼ ¼ ¼ ¼ r n F n1 r n F n2 ¼ 1 r n F nn 41 Solving for the radiosity? Full matrix solution is impractical! Suppose there are 10,000 polygons. - Each divided into 10 patches (say). - n = 100,000 (patches) - n 2 = 10,000,000,000 (form factors) - Each form factor requires an element in the matrix. Hard to compute ALL simultaneously! 42 18
Solve the equation row by row, without ever storing the full matrix. Progressive Refinement Consider: Solving for the radiosity B i E i p i n j 1 B j F ij B i due to B j = r i B j F ij A single term determines influence of j on i. 43 Computation of Radiosity We shoot light out from patch i, allowing it to make a contribution to all other patches j - adjusting the radiosities of each of these other patches. Note the only form-factors needed are from that row of the matrix 44 19
Computation of Radiosity Iterate until convergence (or stop early) E i = E i-1 + FB i-l AKA: Jacobi iteration 45 Computation of Radiosity Iteration 0 46 20
Computation of Radiosity Iteration 1 47 Computation of Radiosity Iteration 2 48 21
Computation of Radiosity Iteration 3 49 Radiosity Examples 51 22
54 Advantages of Radiosity Global illumination method: modeling diffuse inter-reflection Color bleeding: a red wall next to a white one casts a reddish glow on the white wall Soft shadows: an area light source casts a soft shadow from a polygon No ambient hack View independent: assigns a brightness to every surface 55 23
Disadvantages of Radiosity Radiation is uniform in all directions Radiosity is piecewise constant No surface is transparent or translucent Must determine how to subdivide shapes into small enough patches 56 24