<<

Global Illumination Why Global Illumination

• Last lecture – Basic rendering concepts – Primitive-based rendering • Today: – Global illumination – , and Radiosity (Light-based rendering)

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

What’s Global Illumination Pros/Cons and Applications

• Global illumination algorithms used in • Advantages are those which, when determining the light falling on a – Accurately predict the appearance of real world surface, take into account not only the light which has taken – Generate correct and better images a path directly from a light source (direct illumination), but • Disadvantages also light which has undergone reflection from other – Too complex to solve analytically surfaces in the world (indirect illumination). – Expensive to get numerical solution From Wikipedia, the free encyclopedia • Applications – Movie…..

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

1 Global Illumination Equation Global Illumination Equation

• Reflection Equation • The total light leaving a point is given by the sum of two major terms: – Exitance from the point – Incoming light from other sources reflected at the point

Incoming light Light Sum BRDF leaving Incoming light reflected at the point Light Exitance Sum BRDF Incoming leaving light

• Energy Balance Equation Incoming light reflected at the point Shadow rays Primary ray

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Photorealistic Rendering Computing Light Transport

• Photorealistic Rendering requires solving the equation! • Light sources emit light – Not possible in the general case with today’s technology • Surface reflect or absorb light • Light transport is the problem of figuring out where the • We want to know how much light ? light’s power goes reaches the , and what color it is – Depends on the geometric arrangement and the surface properties • First, we need to describe lights and how surfaces reflect lights.

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

2 Light Sources Reflectance Modeling

• Sources emit light: • Reflectance modeling is concerned with the way in which – Point Light light reflects off surfaces – Spot Light • Physical quantity is BRDF: Bidirectional Reflectance – Area Light Distribution Function – Distant Area Light – A function of a point on the surface, an incoming light direction, and (sky, environment map) an outgoing light direction – Tells you how much of the light that comes in from one direction goes out in another direction – General BRDFs are difficult to work with, so simplifications are made

From Matt Pharr et al., “Physically Based Rendering ”

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Simple BRDFs Classifying Rendering Algorithms

• Diffuse surfaces (Lambertian): • One way to classify rendering algorithms is according to the – Uniformly reflect all the light they receive type of light interactions they capture – A reasonable approximation for matte paints, soot, carpet • For example: The OpenGL lighting model captures: • Perfectly specular surfaces: – Direct light to surface to eye light transport – Reflect incoming light only in the mirror direction – Diffuse and rough specular surface reflectance • Rough specular surfaces: – It actually doesn’t do light to surface transport correctly, because it – Reflect incoming light around the mirror direction doesn’t do shadows • Diffuse + Specular: • We would like a way of describing interactions: light paths – A diffuse component and a specular component • Fresnel surfaces: – Reflect some and transmit some depending on incoming direction

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

3 Describing Light Paths Simple Light Path Examples

• Describe light paths according to where they come from, where they go • LE to, and what they do along the way S or D – The light goes straight from the source to the • Assume only two types of surface interactions: S or D viewer – Pure diffuse, D S or D • LDE – Pure specular, S – The light goes from the light to a diffuse surface • Assume all paths of interest: that the viewer can see – Start at a light source, L Light Eye – End at the eye, E • LSE • Use regular expressions on the letters D, S, L and E to describe light – The light is reflected off a mirror into the viewer’s paths eyes – Valid paths are L(D|S)*E • L(S|D)E – Light, followed by either diffuse or specular, zero or more times, ending at – The light is reflected off either a diffuse surface or the eye a specular surface toward the viewer

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

More Complex Light Paths More Complex Light Paths

• Find the following: LE LDDE – LE – LDE – LSE – LDDE LSDE – LDSE – LSDE LSE Radiosity Cornell box, LDSE due to Henrik wann Jensen, http://www.gk.dtu.dk/ LDE ~hwj, rendered with ray tracer 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

4 The OpenGL Model Raytracing

• The “standard” graphics lighting model captures only • Cast rays out from the eye, through each pixel, and determine what they L(D|S)E hit first – Builds the image pixel by pixel, one at a time • It is missing: • Cast additional rays from the hit point to determine the pixel color – Light taking more than one diffuse bounce: LD*E – Shadow rays toward each light. If they hit something, then the object is • Should produce an effect called color bleeding, among other things shadowed from that light, otherwise use “standard” model for the light • Approximated, by ambient light – Reflection rays for mirror surfaces, to see what should be reflected in the – Light refracted through curved glass mirror • Consider the refraction as a “mirror” bounce: LDSE – Transmission rays to see what can be seen through transparent objects – Light bouncing off a mirror to illuminate a diffuse surface: LS+D+E – Sum all the contributions to get the pixel color – Many others

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Raytracing Recursive Ray Tracing

• When a reflected or refracted ray hits a surface, repeat the Shadow rays whole process from that point – Send out more shadow rays – Send out new reflected ray (if required) – Send out a new refracted ray (if required) Reflection ray – Generally, reduce the weight of each additional ray when computing the contributions to surface color – Stop when the contribution from a ray is too small to notice • What light paths does recursive ray tracing capture?

Transmitted ray

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

5 Ray Tree

B Eye

A L1 A L1 L2

C B L2

L2 C L1 L2 L1 PCKTWTCH by Kevin Odhner, POV-Ray

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Kettle, Mike Miller, POV- Ray

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

6 Which paths are missing in Raytracing? Missing Paths

• Raytracing cannot do: – LS*D+E: Light bouncing off a shiny surface like a mirror and illuminating a diffuse surface – LDD+E: Light bouncing off one diffuse surface to illuminate others • Basic problem: The raytracer doesn’t know where to send rays out of the diffuse surface to capture the incoming light

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Light Caching Caustics

• Cast rays from the light sources out into the scene: shoot – When a ray hits a diffuse surface, accumulate some light there – Surfaces record the amount of light that hits them • Store the light in texture maps • Store the light in quadtrees • Store the light in photon maps • Cast rays from the eye out into the scene: gather – When a ray hits a diffuse surface, look up the amount of light that Standard raytracer: Bi-directional More rays in the Diffuse table and blue ball, raytracer light pass hit it in the light-ray phase mirrors left, right and back, • What paths does it capture? transparent red ball Note the LS*DS*E paths • What sort of do you see? From Alan Watt, “

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

7 Refraction caustic Refraction caustics

Henrik wann Jensen, Henrik wann Jensen, http://www.gk.dtu.dk/~hwj http://www.gk.dtu.dk/~hwj

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Still Missing… Radiosity Example

• LD*E paths – Diffuse-diffuse transport • Color bleeding is extreme in this example – Formulated and solved with radiosity methods • Textures are applied after – Color bleeding solving for illumination

From Alan Watt, “3D Computer Graphics”

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

8 Radiosity Assumptions Radiosity Meshing

• All surfaces are perfectly diffuse • Each patch is colored with its – Means that is doesn’t matter which way light hits or leaves a surface illumination • Illumination is constant over a patch • Note the discrete nature of the solution – Can break the world up into a discrete number of pieces – Problems at sharp illumination boundaries - shadows • The previous image was – Ways around these problems, but less efficient and less able to obtained by pushing color to manage scene complexity vertices and then Gourand shading • Assumptions allow us to solve for LD*E paths

From Alan Watt, “3D Computer Graphics”

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

Monte Carlo Rendering for GI Monte Carlo Rendering for GI

• Most general cases – L(S|D)*E paths • Using Monte Carlo simulation to compute global illumination – – Bi-direction Path Tracing – – Metropolis Light Transport (MLT) – Metropolis Photon Sampling (MPS) – Bidirectional Importance Sampling

From Eric Veach, “Robust Monte Carlo Methods for Light Transport Simulation” 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan 11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

9 Acknowledgement

• Most slides are directly copied from Stephen Chenney’s course lectures http://www.cs.wisc.edu/~schenney/courses/ • Thank Stephen for answering my questions on some slides

11/17/2005 (c) 2005 University of Wisconsin Shaohua Fan

10