Local Vs. Global Illumination & Radiosity
Total Page:16
File Type:pdf, Size:1020Kb
Last Time? Local vs. Global Illumination • Ray Casting & & Radiosity Ray-Object Intersection • Recursive Ray Tracing • Distributed Ray Tracing An early application of radiative heat transfer in stables. Today BRDF • Local Illumination • Ratio of light coming from one direction – BRDF that gets reflected in another direction – Ideal Diffuse Reflectance – Ideal Specular Reflectance • Bidirectional Reflectance – The Phong Model Distribution Function • Why is Global Illumination Important? – 4D • Radiosity Equation/Matrix – R(θi ,φi ; θo, φo) • Calculating the Form Factors Incoming Radiance Ideal Diffuse Reflectance • The amount of light received by a • Assume surface reflects equally in surface depends on incoming angle all directions (a.k.a. Lambertian) – Bigger at normal incidence • An ideal diffuse surface is, n at the microscopic level, (Winter/Summer difference) l a very rough surface • By how much? dB • Examples: chalk, Surface – dB = dA cos θ θ clay, some paints – Same as: l . n (dot product with normal) dA Surface 1 Ideal Specular Reflectance Non-Ideal Reflectors • Assume surface reflects n • Real materials tend to be neither only in mirror direction ideal diffuse nor ideal reflective θ θ – View dependent r l • Highlight is blurry, looks glossy • Microscopic surface elements are oriented in Surface the same direction as the surface • Examples: mirrors, highly polished metals Non-Ideal Reflectors The Phong Model • Most light reflects in the ideal reflected direction • How much light is reflected “specularly”? • Microscopic surface variations will reflect light – Depends on the angle between the ideal reflection direction and the viewer direction α. just slightly offset n • How much light is reflected? Camera r θ θ α l ks: specular reflection coefficient q : specular reflection exponent v Surface Effect of the q exponent The Phong Model Ambient Illumination • Sum of three components: • In a typical room, everything receives at least a diffuse reflection + specular reflection + “ambient”. little bit of light • Ambient illumination represents the reflection of all indirect illumination Surface • This is a total hack! variations in Phong specular exponent 2 Anisotropic BRDFs Questions? • Surfaces with strongly oriented microgeometry • Examples: – brushed metals, hair, fur, cloth, velvet Source: Westin et.al 92 Lightscape http://www.lightscape.com Today Why Global Illumination? • Local Illumination • Simulate all light inter-reflections (indirect lighting) • Why is Global Illumination Important? – in a room, a lot of the light is indirect: it is reflected by walls. • How have we dealt with this so far? – The Cornell Box – Ambient term to fake some uniform indirect light – Radiosity vs. Ray Tracing ray tracing indirect illumination “right” answer • Radiosity Equation/Matrix • Calculating the Form Factors + = (no ambient term) it is smooth, but not constant! Henrik Wann Jensen Why Radiosity? Radiosity vs. Ray Tracing • Sculpture by John Ferren • Diffuse panels photograph: Original sculpture by Ray traced image. A standard Image rendered with radiosity. diagram John Ferren lit by ray tracer cannot simulate the note color bleeding effects. daylight from behind. interreflection of light between from above: diffuse surfaces. eye 3 Reading for Today: The Cornell Box • Careful calibration and measurement allows for comparison between physical scene & simulation photograph Goral, Torrance, Greenberg & Battaile photograph simulation Modeling the Interaction of Light Between Diffuse Surfaces Light Measurement Laboratory simulation SIGGRAPH '84 Cornell University, Program for Computer Graphics Two approaches for global illumination Visualizing Inter-reflections… • Radiosity – View-independent – Diffuse materials only • Monte-Carlo Ray-tracing – Send tons of indirect rays direct illumination 1 bounce 2 bounces (0 bounces) images by Micheal Callahan http://www.cs.utah.edu/~shirley/classes/cs684_98/students/callahan/bounce/ Radiosity vs. Ray Tracing Today • Ray tracing is an image-space algorithm • Local Illumination – If the camera is moved, we have to start over • Why is Global Illumination Important? • Radiosity is computed in object-space • Radiosity Equation/Matrix – View-independent • Calculating the Form Factors (just don't move the light) – Can pre-compute complex lighting to allow interactive walkthroughs 4 Radiosity Overview Discrete Radiosity Equation • Surfaces are assumed to be Discretize the scene into n patches, over which the radiosity is constant perfectly Lambertian (diffuse) – reflect incident light in all light leaving directions with equal intensity material patch i reflectivity • The scene is divided into a set A j n of small areas, or patches. B i = E i + ρ i ∑ Fij B j • The radiosity, Bi, of patch i is j=1 the total rate of energy leaving a light emitted surface. The radiosity over a form factor patch is constant. ω' from patch i • Units for radiosity: 2 The equation is recursive, but Watts / steradian * meter A i x' it can be solved iteratively Radiosity in Matrix Form Solving the Radiosity Matrix n The radiosity of a single patch i is updated for each iteration by B i = E i + ρ i ∑ Fij B j gathering radiosities from all other patches: j=1 n simultaneous equations with n unknown Bi values can be written in matrix form: Radiosity values Radiosity values A solution yields a single radiosity value Bi for each patch in the on iteration t+1 on iteration t environment, a view-independent solution. This method is fundamentally a Gauss-Seidel relaxation Interpolating Vertex Radiosities Questions? • Bi radiosity values are constant over the extent of a patch. • How are they mapped to the vertex radiosities (intensities) needed by the renderer? – Average the radiosities of patches that contribute to the vertex – Vertices on the edge of a surface are assigned values extrapolation Factory simulation. Program of Computer Graphics, Cornell University. 30,000 patches. 5 Today Calculating the Form Factor Fij • Local Illumination • Fij = fraction of light energy leaving patch j • Why is Global Illumination Important? that arrives at patch i • The Rendering Equation • Takes account of both: • Radiosity Equation/Matrix – geometry (size, orientation & position) – visibility (are there any occluders?) • Calculating the Form Factors patch j patch j patch j patch i patch i patch i Calculating the Form Factor Fij Form Factor from Ray Casting • Fij = fraction of light energy leaving patch j that arrives at patch i • Cast n rays between the two patches patch j – n is typically between 4 and 32 – Compute visibility (see if the ray hits an occluder) θj – Integrate the point-to-point form factor r • Permits the computation A j θi of the patch-to-patch patch i form factor, as opposed to point-to-patch cos θ cos θ A i 1 i j Fij = ∫ ∫ 2 Vij dAj dAi Ai Ai Aj π r Form Factor Determination Hemicube Algorithm The Nusselt analog: the form factor of a patch is equivalent to the fraction of the • A hemicube is constructed around the center of each patch the unit circle that is formed by taking the projection of the patch onto the hemisphere surface and projecting it down onto the circle. • Faces of the hemicube are divided into "pixels" • Each patch is projected (rasterized) onto the faces of the hemicube • Each pixel stores its pre-computed form factor The form factor for a particular patch is just the sum of the pixels it overlaps • Patch occlusions are handled similar to z-buffer rasterization 6 Questions? Readings for Tuesday 3/4 (pick one): • “The Rendering Equation”, Kajiya, SIGGRAPH 1986 • “A Two-Pass Solution to the Rendering Equation: A Synthesis of Ray Tracing and Radiosity Methods” Wallace, Cohen, & Greenberg, SIGGRAPH 1987 direct illumination indirect illumination full solution (standard raytracing) (standard radiosity) Lightscape http://www.lightscape.com 7 .