1.17k likes | 1.67k Views
Graphics & Visualization. Chapter 16 GLOBAL ILLUMINATION ALGORITHMS. Introduction. Global Illumination Algorithms: Deal with the realistic computation of light transport in a scene Estimate indirect illumination, i.e. light reaching a point through multiple surface inter-reflections
E N D
Graphics & Visualization Chapter 16 GLOBAL ILLUMINATION ALGORITHMS Graphics & Visualization: Principles & Algorithms Chapter 16
Introduction • Global Illumination Algorithms: • Deal with the realistic computation of light transport in a scene • Estimate indirect illumination, i.e. light reaching a point through multiple surface inter-reflections • Compute both direct illumination and indirect light • Images are radiometrically accurate and photorealistic • All aspects of the image-generator pipeline are based on physics: • The reflection properties of all materials are described by BRDFs • The light sources are radiometrically modeled • The transport of light through the scene is computed accurately • The display of the image uses accurate tone-mapping operators Graphics & Visualization: Principles & Algorithms Chapter 16
The Physics of Light-Object Interaction II • The rendering equation: • Is the most fundamental equation for photorealistic synthesis • Expresses the equilibrium of light distribution in a 3D scene • Takes into account: • The radiometric specification of the light sources • The BRDF specifications of all materials • It is an energy balance that expresses how much excitant radiance is present at a given surface point in a certain direction Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Hemispherical Integration • BRDF at a surface point x: • Expresses excitant radiance Lr in direction (φr, θr) versus incident irradiance Eifrom direction (φi, θi): (16.1) • Integrate Eq(16.1) over the hemisphere Ωi of all possible differential solid angles dωi: Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Hemispherical Integration (2) • Add a constant term, which corresponds to the self-emitted radiance Le(φr, θr) of point x • The complete rendering equation is: (16.2) Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Surface-Area Integration • We can move from solid angle to surface integration domain • The integral is taken over all visible surfaces • Transform dωi to the corresponding differential surface dA • Let • y: the first visible surface point seen from point x in direction (φi,θi) • (φiyθy) : the direction pointing from y towards x • rxy: the distance between x and y • Svisible: the set of all visible surfaces as seen from x • Then: • Then Lr becomes: (16.3) Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Surface-Area Integration (2) • Radiance remains constant along a straight line (no scattering), so we may replace received radiance with emitted radiance at the source: • In equation Eq(16.3): • the product of both cosine terms divided by rxy2 • is a geometric coupling term • is dependent on the geometrical relationship between x and y • is independent of the actual radiance distribution or BRDF's defined on the surfaces: Graphics & Visualization: Principles & Algorithms Chapter 16
Substituting all of the above in Eq[16.3]: Rendering Equation: Surface-Area Integration (3) 8 Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Surface-Area Integration (4) • Integral over all surfaces is preferable to integral over visible surfaces only: • Advantage: Single integration domain, identical for all points x • We introduce a visibility term V(x, y): • The rendering equation becomes: S: the integration domain indicating all surface point y Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Surface-Area Integration (5) • A special case: • Direct illumination from one light source S1 : the surface area domain of the light source • Direct illumination from more light sources: • Split the integral in a sum of integrals for each light source Graphics & Visualization: Principles & Algorithms Chapter 16
Rendering Equation: Surface-Area Integration (6) • Direct illumination from one light source Graphics & Visualization: Principles & Algorithms Chapter 16
Environment Map Illumination • The light source is encoded as a (hemi)-spherical environment map • An emitted radiance Le(φi,θi) is defined for each incoming direction • Usually is given as a high dynamic range image • Can contain more than a million pixels Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation • For some applications, it is useful to express: • Light energy per surface patch (usually individual polygons) • The hemisphere of all outgoing directions • Achieved by discretizing the rendering equation • We solve a linear system: each equation describes the energy balance of a single patch Radiosity algorithms • Note that not all of these algorithms use the radiosity B radiometric quantity Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (2) Assumptions for the formulation of radiosity equations: • All surfaces in the scene are subdivided in surface patches • The outgoing radiance is similar for all surface points on the patch • The algorithm will compute only the average radiance of all surface points • All surface patches have diffuse reflectance characteristics • Each patch has only 1 radiance value as a final solution • The light sources are considered to be diffuse as well (although this is not strictly necessary) Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (3) • Radiosity B for a single point x • Is the flux per surface area, or • Radiance integrated over the hemisphere of outgoing directions at x • Average radiosity Bi emitted by a surface patch i with area Ai: • On purely diffuse surfaces: • self-emitted radiance Le and the BRDF fr do not depend on incoming or outgoing directions • Rendering equation for a surface point x: Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (4) • The incident radiance Li(x,φi,θi): • depends on incident direction • corresponds to the exitant radiance Lr(y) emitted towards x by the point y visible from x along the direction (φi,θi) • The integral equation without any directions present: • In a diffuse environment: • Radiosity and radiance are related • B(x) = π Lr(x) and Be(x) = π Le(x) Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (5) • Radiosity Integral equation: • Multiply by π of the light- and left- hand side of the above equation whereρ(x) = πfr(x) :the diffuse hemispherical reflectance andK(x,y) = G(x, y)V(x, y) • The rendering equation becomes: 16.4 Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (6) • Assume the radiosity B(x) is constant over each surface element i: • B(x) = Bi for all x Si • Eq[16.4] can be converted into a linear system as follows: Graphics & Visualization: Principles & Algorithms Chapter 16
Discretized Form of the Rendering Equation (7) • Assume the hemispherical diffuse reflectivity is constant over the surface patch: • i.e. ρ(x) = ρi for all x Si • the following classical radiosity system of equations results: • Patch-to-patch form factors Fij : • The form factors: • represent the amount of energy transfer between 2 surface patches i and j • are nontrivial 4D integrals • depend on the geometry of the scene • do not depend on any specific configuration of light sources Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration • Is an important tool for evaluating the global illumination equation • Evaluates integrals based on a selection of random samples in the integration domain • The Monte Carlo method: • Generates random points in the integration domain • Evaluates the integrand in each random sample • Averages these evaluations • Works no matter how complex the function to be integrated is • Drawback: • Slow converge rate: when drawing N samples, we expect a converge rate of Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration (2) Verification of the method: • Evaluate the following 1D integral: • Draw uniformly N samples x1, x2,…, xNfrom the domain [0,1] • Average the function evaluations f(xi) to obtain an estimation for I: • The expected value of equals the value of I: • Every different computation of will yield a different result • But on average, we will get the same answer. Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration (3) • The variance σ2 indicates the spread of possible values of around the expected outcome I: • As the number of N increases: • σ2 decreases linearly with N σdecreases with • To decrease the error by a factor of 2 need 4 times as many samples • The converge speed: • Is lower than that of many other integration techniques, but • Is independent of the number of dimensions in the integral Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration (4) Generalization: • Generalize to the domain [a,b] and use a non-uniform probability density p(x) to draw the samples: • Again • The pdf p(x) has to: • Be strictly larger than 0 over the entire integration domain • Integrate to 1: Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration (5) • To draw samples distributed according to p(x): • Compute the cumulative distribution function P(x): P(x): is a monotonic increasing function over [a,b] P(a) = 0 and P(b) = 1 • If a random number t is generated uniformly over [0,1], then x = P-1(t) is distributed according to p(x) • In practice, to compute the inverse value quickly: • Compute the inverse cumulative function • Store it as a table • Use binary search to compute the inverse value Graphics & Visualization: Principles & Algorithms Chapter 16
Monte Carlo Integration (6) • Multidimensional Monte Carlo integration: • Works in the same way as 1D integration • If the integral is defined over a domain [a, b]×[c, d]: • Advantages: • simple to implement • Very robust • Provides an answer independent of: • The complexity of the function • The dimensions of the domain • Drawbacks: • The error is hard to control and cannot be expressed by explicit lower and upper bounds Graphics & Visualization: Principles & Algorithms Chapter 16
Computing Direct Illumination • Usually involves applying Monte Carlo integration • Assumptions: • Compute the reflected radiance value • In a surface point x • In a specific direction (usually the direction pointing towards the camera) Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source • Integration domain: the surface Sl of the light source • Pdf p(y): generates surface points yi over the total light source area • Use N sample points {y1, y2,…, yN} • The estimator for the radiance value Lr(x,φr, θr): • Pdf p(y): • Is a 2D pdf • Generates 2 coordinates u and v • Transformed to a 3D point on the surface with a proper mapping • The mapping is identical to the texture-mapping procedure Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (2) • Each point on the light source has pdf p(yi) ≠0, otherwise: • Some parts of the light source will not be sampled • The estimated radiance will be biased Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (3) Algorithm: // direct illumination from a single light source // for a surface point x, direction phi, theta directIllumination (x, phi, theta) estimatedRadiance = 0; for all shadow rays generate point y on light source; estimatedRadiance += Le(y,phi_y,theta_y)*BRDF*radianceTransfer(x,y)/pdf(y); estimatedRadiance = estimatedRadiance / #shadowRays; return(estimatedRadiance); Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (4) Algorithm (cont.): // transfer between x and y // 2 cosines, distance and visibility taken into account radianceTransfer(x,y) transfer = G(x,y)*V(x,y); return(transfer); • Evaluating the visibility term V(x, yi): • Shoot a shadow ray from x towards y • Check whether any objects are blocking the visibility Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (5) Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (6) Noise factors: • The visibility function V(x, yi) • V(x, yi) = 1 yi light source fully visible to x • V(x, yi) = 0 yi light source fully occluded • Otherwise, artifacts will occur • Increase the number of samples to smooth the soft shadow • The number of samples depends on the size of penumbra region • The geometric coupling term G(x, yi): • Not a problem when the light source is small • When it is large, for points x located close to it: • 1/ rxyj takes on arbitrary large values (instability) • Results to very bright pixels Graphics & Visualization: Principles & Algorithms Chapter 16
Single Light Source (7) Noise factors (cont.): • BRDFs: • If the BRDF values vary largely, the picture has additional noise • Pdf p(y): • Can choose any pdf • Usually is uniform over the source light Graphics & Visualization: Principles & Algorithms Chapter 16
Multiple Light Sources • Two approaches: • Individual light sources • Combined light sources • Individual light sources • All light sources are individual contributors to the illumination of a single point: • Light is linear additive the separate contributions of each light source can be added • A number of shadow rays is generated for each light source: they can be chosen independently Graphics & Visualization: Principles & Algorithms Chapter 16
Group all light sources in a single integration domain: Apply Monte Carlo integration to the combined integral Shadow rays can be directed to any of the light sources May even compute the direct illumination with a single shadow ray for each point (although this can be very noisy) Still need access to any of the light sources Multiple Light Sources (2) 35 Graphics & Visualization: Principles & Algorithms Chapter 16
Multiple Light Sources - Combined • A two-step sampling process for each shadow ray: • Assign each light a probability value for it being chosen • A discrete pdf pL(k) generates a randomly selected light source ki among NL lights • A surface point yi ,on the selected light source k is selected using a conditional pdf p(y|ki) • pL(k) p(y|k): the combined pdf for the sampled point yi on the combined area of all light sources • The total estimator, using N shadow-rays, is: Graphics & Visualization: Principles & Algorithms Chapter 16
Multiple Light Sources - Combined (2) Algorithm: // direct illumination from multiple light sources // for surface point x, direction phi, theta directIllumination (x, phi, theta) estimatedRadiance = 0; for all shadow rays select light source k; generate point y on light source k; estimatedRadiance += Le(y, phi_y, theta_y) * BRDF * radianceTransfer(x,y) / (pdf(k) * pdf(y|k)); estimatedRadiance = estimatedRadiance / #shadowRays; return(estimatedRadiance); Graphics & Visualization: Principles & Algorithms Chapter 16
Multiple Light Sources - Combined (3) Algorithm (cont.): // transfer between x and y // 2 cosines, distance and // visibility taken into account radianceTransfer(x,y) transfer = G(x,y)*V(x,y); return(transfer); Graphics & Visualization: Principles & Algorithms Chapter 16
Choosing pdfs for MLS • Any valid pdfs for ( pL(k) and p(y|k) ) will produce unbiased results • The choice of pdfs affects the variance of the estimators • Two of the more common PDFs ( pL(k) and p(y|k) ): • Uniform source selection / uniform area sampling • Power-proportional source selection / uniform sampling Graphics & Visualization: Principles & Algorithms Chapter 16
Uniform source selection / uniform light source area sampling Both PDFs are uniform: pL (k) = 1/NL and p(y|k) = 1/SLk Every light source will receive an equal number of shadow rays The shadow rays are distributed uniformly Disadvantage Equal number of shadow rays for both: Bright and weak lights Near and far or invisible lights Estimator for the direct illumination: Choosing pdfs for MLS – Uniform/uniform 40 Graphics & Visualization: Principles & Algorithms Chapter 16
Choosing pdfs for MLS – power-driven/uniform Power-proportional source selection / uniform light area sampling • pL (k) = Pk/Ptotal with Pk: the radiant power of light source k Ptotal: the total power emitted by all light sources • Bright sources receive more shadow rays than dim sources • Estimator: • If all lights are diffuse: • Superior approach • Results in slower converge at pixels where: • Bright lights are invisible • Illumination comes from less bright lights Graphics & Visualization: Principles & Algorithms Chapter 16
Drawbacks of the unified MLS • We must be careful not to exclude any lights contribute to Lr(x, φr, θr) • 3 random numbers are needed to generate a shadow ray • One to select the light source k • 2 to select a specific surface point Graphics & Visualization: Principles & Algorithms Chapter 16
Environment Map Illumination • Environment maps: • Encode the total illumination on the hemisphere of directions around a point • Are usually captured in natural environments with digital cameras • Mathematically: is a stepwise continuous function • Each pixel corresponds to a small solid angle ΔΩ around point x • Intensity of each pixel corresponds to incident radiance value • Capturing environment maps: • Most common techniques: • A light probe in conjunction with a digital camera • A digital camera equipped with a fisheye lens Graphics & Visualization: Principles & Algorithms Chapter 16
Capturing Environment Maps - Probe • A light probe in conjunction with a digital camera • Light probe: a specularly reflective ball • Probe is positioned at the point where the incident illumination needs to be captured Graphics & Visualization: Principles & Algorithms Chapter 16
Capturing Environment Maps – Probe (2) Issues to be considered: • The camera will be present in the photo blocks light coming from behind the camera • Not uniform sampling of directions over the hemisphere • All directions at the edge of the image represent illumination from the same direction • the light probe has small radius • The camera cannot capture all illumination levels • Solution for some of the above problems: • Capture 2 photos 90 degrees apart Graphics & Visualization: Principles & Algorithms Chapter 16
Capturing Environment Maps – Probe (3) Graphics & Visualization: Principles & Algorithms Chapter 16
2 photos taken from opposite view directions Fisheye lenses are expensive and hard to calibrate Both images need to be taken in perfect opposite view directions Capturing Environment Maps – Fisheye lens 47 Graphics & Visualization: Principles & Algorithms Chapter 16
Environment Map Parameterization • Environment maps need to be expressed in some parametric space • latitude-longitude • Projected-disk • Paraboloid • Concentric-map Graphics & Visualization: Principles & Algorithms Chapter 16
Environment Map Sampling • The direct illumination of a surface point due to an environment map: • Lmap (φi,θi) : the incident illumination on x, coming from (φi,θi) • Add a visibility term V(x ,φi,θi) for cases where: • Other surfaces prevent the light from reaching x • The object to which x belongs can cast a self-shadow onto x • Estimator from Monte Carlo integration: Graphics & Visualization: Principles & Algorithms Chapter 16
Environment Map Sampling (2) • Various problems with Monte Carlo integration increased variance and noise: • Integration domain has a large extent • Environment map ≈ textured light source high frequencies and discontinuities • Product of environment map and BRDF. Specular BRDF peaks and environment map peaks do not coincide in general, resulting in sharp variations of their dot product • Visibility discontinuities Graphics & Visualization: Principles & Algorithms Chapter 16