cs123 | introduction to computer graphics andries van dam © october 22, 20151 of 56 illumination...

56
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 2015 1 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box rendered using photon mapping Photo credit: Ben Herila, 2010

Upload: alexander-wade

Post on 13-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015 1 of 56

Illumination and Light TransportChapters 26, 29, 31, 33

Cornell box rendered using photon mapping

Photo credit: Ben Herila, 2010

Page 2: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

What is Light? Local vs. Global Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

2 of 56October 22, 2015Animation source: http://upload.wikimedia.org/wikipedia/commons/f/f5/Light_dispersion_conceptual_waves.gif

Page 3: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Light can be thought of as small packets of energy called photons but it exhibits both wave and particle properties (see Slide 5)

For sound, wavelength determines pitch, with light it determines color we see: red has longest and violet the shortest wavelength

Every atom has a nucleus which electrons orbit* at various levels When an electron drops from a higher level orbit to a lower, energy

(photons) are emitted (Planck relation) E=hf (frequency of emitted light increases with energy, h is Planck’s

constant) – the higher the frequency, the more energy (red vs. ultraviolet)

When an emitted photon strikes another atom and is absorbed, electrons jump from a lower orbital to a higher one

The wavelength (color) of light emitted or absorbed corresponds to change in orbital; The nature of atoms and their electrons control type of light emission

*Note: The picture is greatly oversimplified. Electron orbits are quantum levels that describe the probabilities of an electron’s location. And no, electrons don’t move in circles.

The Microscopic View of Light (see Chapter 26)

E1E2

3 of 56

Page 4: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

The different energy levels of electrons allow for different wavelengths of light to be reflected Metals have “loose” electrons which

can move relatively freely and occupy many different energy levels, which is why they are more reflective

Insulators have more constrained electrons which cannot change energy levels as easily, so they convert more absorbed light into heat instead of reflecting it

The Microscopic View of Light

Cloud Gate, Millenium Park, Chicago http://greghumphries.com/ Charcoal, source: http://budgetwarehouse.wordpress.com/party-needs/charcoal/

4 of 56

Page 5: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Light is a type of electromagnetic radiation and can also be thought of as a continuous wave (as opposed to discrete photons)

The particle description is best used to determine how energy is exchanged

The wave nature of light is best used to describe how light propagates or travels, at light speed in space and air, but changes speed in different media as a function of indices of refraction, hence the prism’s dispersion – violet w/ highest frequency/energy slows more than red with lowest frequency/energy (Huygen’s Principle, Snell’s Law…)

Visible light has a wavelength between about 390nm – 700nm, a tiny portion of the entire spectrum

Different wavelengths correspond to different colors; the 3 types of cones in retina react (non-uniformly) to all wavelengths in visual spectrum but have max response in different points on spectrum

See Tyson’s Cosmos’ “Hiding in the Light” about light (from the ancients to Newton to Fraunhofer)

The Macroscopic View of Light

5 of 56

Page 6: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

The Electromagnetic Spectrum

6 of 56

Full electromagnetic spectrum Visible light has a wavelength between about 390nm – 700nm, a tiny portion

of the spectrum We’re only interested in the visible spectrum – we define and group major

wavelength ranges, approximately red, green, and blue

Vertical diagram: http://upload.wikimedia.org/wikipedia/commons/2/25/Electromagnetic-Spectrum.svg

Page 7: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? Local vs. Global

Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global Illumination

Techniques

Outline

7 of 56Photo source : http://www.overclock.net/art-graphics/251218-kerkythea-shaded-lightsource-test.html

Page 8: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Crudest hack: take only direct lighting information from light sources into account when computing a sample

Usually involves an “ambient term” to set a sort of minimum bar for inter-object reflection and thus light up visible surfaces

Used in OpenGL <3.0, most traditional hardware pipelines (“fixed function” as opposed to programmable shader- driven pipelines on modern GPUs)

Illumination Models: Direct (non-global) Illumination

Nancy Tom’s Sceneview scene, rendered using OpenGL with only local illumination (2001).

8 of 56

The fixed-function pipeline is deprecated in OpenGL 3.0, and removed in 3.1+

Page 9: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Simulates how other objects affect light reaching a surface element

Lights and shadows

most light striking a surface element comes directly from emissive light sources

sometimes light from a source to a surface element is blocked by other objects; surface element is then in “shadow” from that light source, the blocker/occluder

classical h/w pipeline doesn’t account for blockers since each triangle is considered purely by itself

Inter-object reflection (indirect illumination)

light bounces off other objects toward our surface element, to add to direct illumination; diagram shows only a single specular ray out of a potentially infinite number of rays

Illumination Models: Global Illumination

eye

light light

direct illumination

indirect illumination

object object

object

from Pixar’s “Luxo Jr.”

9 of 56

Page 10: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Global Illumination

Direct illumination + Indirect illumination = Total illumination

10 of 56

Page 11: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Diffuse Interreflection

Total illumination (normal image)

11 of 56

Page 12: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Diffuse Interreflection

Direct illumination

12 of 56

Page 13: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Diffuse Interreflection

Indirect illumination (diffuse

interreflection)

13 of 56

Page 14: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Human face

Total illumination (normal image)

14 of 56

Page 15: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Human face

Direct illumination

15 of 56

Page 16: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Human face

Indirect illumination

16 of 56

Page 17: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

http://www.cs.columbia.edu/CAVE/projects/separation/videos/Separation.mov

Video

17 of 56

S. Nayar, G. Krishnan, M. Grossberg, and R. Raskar. “Fast Separation of Direct and Global Components of a Scene using High Frequency Illumination,” SIGGRAPH ‘06

October 22, 2015

Page 18: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Use a high frequency illumination pattern For example a checkerboard pattern of lit

and unlit patches Each patch i that is not directly

illuminated by the pattern should be lit due only to indirect illumination This gives an estimate for indirect

illumination on patch i

How to separate direct and indirect components (1/3)

18 of 56

Algorithm Attribution: S. Nayar, G. Krishnan, M. Grossberg, and R. Raskar. “Fast Separation of Direct and Global Components of a Scene using High Frequency Illumination,” SIGGRAPH ’06 (Full Paper)

Page 19: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Then how do we estimate indirect illumination for patches that fall in a directly illuminated region? Light scene by complement of original illumination pattern e.g., all lit squares in checkerboard become unlit, and all unlit squares

become lit Light on unlit squares is indirect component

Obtain estimate for direct illumination by subtracting the estimate for indirect illumination

How to separate direct and indirect components (2/3)

19 of 56

Page 20: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

In theory, a high frequency pattern and its complement are sufficient for separation. In practice, however, a series of images are used, each with the illumination pattern

shifted slightly. This is because lit and unlit areas still have brightness variations due to inaccuracies in the projector

This technique can be applied to real life scenes use a projector to cast a shifting high frequency pattern and take multiple photographs is a technique from computer vision since we are processing data captured from the real

world Different illumination patterns can be used

checkerboard, sinusoidal pattern, line occluder passes a narrow linear shadow across the scene

Can produce impossible images which cannot be observed in the real world— adjust the blending ratio between indirect and direct illumination components

How to separate direct and indirect components (3/3)

20 of 56

Page 21: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

Computing light transport in a scene with both direct light sources (emitters) and indirect sources, i.e., inter-object reflection – basically an energy balance: the radiance (energy) leaving a point is the sum of emitted and reflected light from other sources

We compute integrals of the recursive form

is the radiance at surface point P in direction is the + hemisphere of all incoming directions to P. is one of those directions represents the amount of light emitted from the material at point P (zero for most objects) represents the BRDF term which is covered in more detail later in this lecture accounts for diminished intensity per unit area as a function of angle to the normal This equation is the foundation of almost all rendering algorithms (radiosity, photon mapping,

path tracing…) It doesn’t handle subsurface scattering, phosphorescence and fluorescence; Also, the terms should

include additional parameters for wavelength and time

The Rendering Equation (Kajiya, Immel et al, 1986)

Image courtesy of: http://en.wikipedia.org/wiki/Rendering_equation 21 of 56

−𝜔𝑖

October 22, 2015

Page 22: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Light energy traveling from point i to j = light emitted from i to j (direct term), plus indirect term, light reflected from i to j. It is the integral over S of the value of the BRDF for every point k reflecting to i and from there to j times light energy L from k to i, all attenuated by a geometry factor G is the total amount of light (radiance) potentially traveling along the ray from point i to point j; occlusion not

taken into account

is the direct term, the amount of light emitted by the surface at point i (luminance)

is the light reflected from i to j, this corresponds to the recursive integral of all indirect energy reflected from i is the Bidirectional Reflectance Distribution Function (BRDF) of surface at i. Describes fraction of light

incident on surface at i from direction of k that leaves surface in direction of j – it is an attenuation factor between 0 and 1, and is a function of the reflection characteristics of the material. It can be measured for real materials

is a geometry term which involves occlusion, distance, and angle between vectors; often 0 because of an occluder

An Alternate Formulation of the Rendering Equation

22 of 56

kj

i

S

Page 23: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

The rendering equation takes into account global information of both direct (from emitters) and indirect illumination (inter-object reflections) Many different approximations with advantages and disadvantages, and their

own resource requirements – in general, more computation gives better results Even purely local model is a zero’th order approximation to rendering eqn.

Examples of Global Models

http://graphics.ucsd.edu/~henrik/images/global.html

Direct illumination + specular reflectionRay trace

+ soft shadows and causticsRay trace + caustic photon map

+ diffuse reflection (color bleeding)Ray trace + caustic and diffuse photon maps

23 of 56October 22, 2015

Page 24: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

Non-global models concentrate on light from direct sources pro: scene can be rendered fast con: pay a price in lost realism; lose interesting effects of

light transport because we ignore effects of all other objects in the scene when considering a particular surface element

Global models concentrate on capturing all illumination information pro: shadows, inter-object reflection, refraction, i.e.

bending of light at translucent surfaces, caustics, volumetric effects of participating media such as air, water, fog, etc.

con: slow Note that top image is darker because diffuse inter-

object reflection is not counted, so no color bleeding. “Ambient” hack compensates for this difference

Illumination Models: Non-global vs. Global Models

http://www.spot3d.com/vray/help/200R1/examples_GI.htm

Direct (diffuse + specular) lighting + indirect specular reflection via recursive ray tracing

Full global model using stochastic simulation for diffuse interreflections (color bleeding)

Ray tracing +Light cache + Irradiance map

24 of 56October 22, 2015

Page 25: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015 25 of 56

Illumination Models: Non-global vs. Global Models

Direct (diffuse + specular) lighting + indirect specular reflection

Full global illumination

Page 26: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Lighting, or illumination, is the process of computing the intensity and color of a sample point in a scene as seen by a viewer

lighting is a function of the geometry of scene (including the model, lights and camera, and their spatial relationships) and material properties (reflection, absorption,…)

Shading is the process of interpolation of color at points in-between those with known lighting or illumination, typically vertices of triangles in a mesh

used in many real time graphics applications (e.g., games) since calculating illumination at a point is usually expensive. In ray-tracing only do lighting for samples (based on pixels or sub-pixel samples for super-sampling), no shading rule

On the GPU processing triangles, lighting is calculated by a vertex shader, while shading is done by a fragment or pixel shader

the term shader is ambiguous, unfortunately, and also not to be confused with shadows

Illumination and Shading

26 of 56

Page 27: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? Local vs. Global Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

27 of 56

Page 28: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Illumination can be computed by: Light transport simulation: Evaluate illumination with enough samples to produce a final

image without any guessing / shading, both for direct and for indirect components often used for high quality renderers, e.g., those used in FX movies

some implementations can run in real time on the GPU, but more complex lighting models that are difficult to parallelize for GPUs are still run on the CPU

renders of highest quality can take days for a single frame, even on modern distributed CPU render farms and/or GPU render farms

Many simulations use stochastic sampling: path tracing, photon mapping, Metropolis light transport

Polygon rendering: Evaluate illumination at several samples, and shade (using a shading rule) in between to produce pixels in the final image often used in real-time applications such as computer games, done in GPU

lower quality than light transport simulation, but can obtain satisfactory results with various additions such as maps (bump, displacement, environment), covered in upcoming lecture

Illumination Models: Computing Illumination

28 of 56

Page 29: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

In Ray assignment, account for light attenuation (affects all models) Amount of light that illuminates an object decreases with square of distance between them For a given 3D angle (solid angle), the area it covers grows with the square of the distance

Intensity of light per unit area falls off with the inverse square Conversely, for a fixed area, the angle it covers decreases with the square of the distance

Slide 45 shows a hack that produces better results

Light Transport: Inverse Square Law

29 of 56

Page 30: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? Local vs. Global Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

Bubble Mathematics, by tlindenbaum

30 of 56

Page 31: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Light arriving at a surface can scatter in many directions The direction of scattering is determined by the material Intensity at a given outgoing direction is dependent on incoming direction and material properties

(how much energy it absorbs, how much it reflects diffusely vs. specularly, etc.) Model or measurement of reflectance is called the

bidirectional reflectance distribution function (BRDF): for any incoming light ray how much energy is reflected for any outgoing light ray

Modeling Reflectance: The BRDF (1/2)

31 of 56

Diffuse Reflections Specular Reflections Total Scattering Distribution (BRDF)

+ =

BRDF for simple model of diffuse + specular reflection, e.g., the Phong Lighting Model

Page 32: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

When light hits a surface, it can be reflected, refracted, absorbed, or otherwise scattered (e.g., subsurface scattering)

BRDF represents material properties of an object and how it reflects light Given an incoming direction, outgoing direction, incident point on object, and properties of lights, BRDF provides how much light reflects off surface

can be measured with equipment or estimated based on some model Note that the BRDF is often implicit in simplest illumination models, and a few

parameters (typically diffuse and specular reflection coefficients) are adjusted experimentally until desired visual outcome is achieved

For this course, primarily concern ourselves with simple reflectance models

Modeling Reflectance: The BRDF (2/2)

32 of 56

Page 33: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Some of these models you have seen before in OpenGL

Lambertian light scatters equally (output radiance is equal) in alloutgoing directions (i.e. viewer independent)

Diffuse light scatters (possibly unevenly) in all outgoing directions, e.g., rug, paper, unvarnished wood

Mirror light scatters in a single direction, Specular light scatters tightly around a particular direction

(shiny objects with sharp highlights) Glossy light scatters weakly around a particular direction

Simple Reflectance Models

33 of 56

ωωr

nn

ω (𝜔 ⋅𝐧 )𝐧ω -

= ω - 2

Page 34: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Lambertian surfaces have uniform, diffuse-only scattering;same apparent brightness independent of view direction and incoming light direction

Most materials are not perfectly Lambertian; most BRDFs are viewer dependent

Lambert’s cosine law:

l)

Modeling Reflectance: Lambertian (1/2)

As angle between light and normal increases , light’s energy spreads across a larger area

3D visualization: hemisphere represents equal magnitude of reflected intensity for any outgoing vector. Real surfaces will have asymmetric BRDFs.

is intensity (light’s color) of directional light (rays parallel to l)

34 of 56

Page 35: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Several lighting models attempt to approximate these phenomena Models you have seen before– no physical foundation, but looks okay

Phong Model Blinn-Phong Model

Some more complicated models are

physically based Cook-Torrance Model Oren-Nayer Model

Which model we use largely depends

on our application Usually a performance vs. accuracy tradeoff

Modeling Reflectance: Lambertian (2/2)

35 of 56Image credit:

http://wiki.blender.org/index.php/File:Manual-Shaders-Lambert.png

Page 36: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Most materials are not perfectly Lambertian; most BRDFs are viewer dependent

this is the specular property of the material

BRDF value is greatest when (when the outgoing angle is opposite the incoming angle ), like a perfect mirror or rippling water

Modeling Reflectance: Specular

36 of 56

Page 37: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

All of these models model light when it hits a surface directly and then scatters

Light may also be scattered/absorbed while traveling through participating media (e.g., fog)

The BRDF can be generalized to model transmission through an object (i.e. refraction) and sub-surface scattering by defining other terms, such as the bidirectional scattering surface reflectance distribution function (BSSRDF)

Modeling Reflection: BSSRDF

Image: No scattering (top) vs. with BSSRDF

scattering (bottom).

Image credit: http://graphics.ucsd.edu/~henrik/images/subsurf.html 37 of 56

Page 38: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Some surfaces may also reflect light internally a little before letting the light escape again (subsurface scattering) marble, skin, wax, hair, milk and other fluids

More complex models are needed to approximate these interactions

Modeling Reflectance: Subsurface Scattering

38 of 56

Page 39: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Researchers collect tables of data for B*DFs of specific materials using devices like the one pictured

The basic idea is to vary a light source around a hemisphere and measure the intensity at that direction.

Modeling Reflectance: Measuring B*DFs

Image credit: Chuck Moidel

39 of 56

Page 40: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? Local vs. Global Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

40 of 56

Page 41: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Simple model (not physically based) Splits illumination at a surface into three components

Ambient – Non-specific constant global lighting (hack) Diffuse – Color of object under normal conditions using Lambert’s model Specular – Highlights on shiny objects (hack)

Proportional to so a larger results in a more concentrated highlight and glossier object

Illumination Models: Phong (1/5) (Review)

41 of 56

Page 42: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Variables λ = color component (approximated by just using three eqn’s for R, G, and B) i = intensity of light as measured at surface ia= the amount of ambient light used in the scene

k = material's efficiency at reflecting light (attenuation coefficient) ka is the ambient attenuation coefficient for this object's material

kd is the diffuse attenuation coefficient for this object’s material (expect ka ≃ kd)

O = innate color of object's material at specific point on surface

(equivalent to C in the OpenGL3D lecture)

Illumination Models: Phong (2/5) (Review)

42 of 56

Page 43: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Illumination Models: Phong (3/5) (Review)

Ambient component effect on surface constant regardless of orientation, no geometric information total hack (crudest possible approximation to inter-object reflection), but makes all objects a little

visible

Diffuse component uses Lambert's diffuse-reflection cosine law (light's intensity) and ℓ (light's direction) vary for each light source ka and kd are ambient and diffuse attenuation coefficients – typically the same

= innate color of object's diffuse material property at specific point on surface = innate color of the object’s ambient material property at specific point on surface, typically same

as Both k and O are non-physical, dimensionless fractions between 0 and 1 – could combine them

43 of 56

Page 44: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

The full Phong model is a combination of ambient, Lambertian and specular terms (summing over all the lights)

Subscript represents specular (so ) is specular coefficient is the reflected direction of the light ray about the surface normal

the smaller the angle δ between V and R, the brighter reflection is the lighting attenuation function

function of distance from the light

Illumination Models: Phong (4/5) (Review)

Note: for a directional light, l is simply a directional vector. For a point light, l must be computed from the light’s positions and the surface point.

44 of 56

Page 45: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

By the inverse square law, density of light energy decreases by the inverse square of the distance from the surface, due to spherical radiation pattern, so

, where

This will attenuate the light intensity according to distance, so farther objects appear darker, i.e. surfaces with equal vary in appearance if they are at different distances from the light – important if two surfaces overlap

But this doesn’t look good – objects illuminated by point lights will look as if they were very harshly lit (things get dark too fast)

Instead, use the following heuristic (hack)

where c1, c2, c3 are experimentally-defined constants

Illumination Models: Phong (5/5) (Review)

45 of 56

Page 46: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Variation on Phong model which modifies the specular term to be more computationally efficient

The new specular term uses the half angle between the viewer and the light (not a function of the orientation/normal) instead of the angle between the reflected light ray and the viewer

is the half angle

l is normalized direction from point to light, V is normalized vector to viewer

Use Blinn-Phong or Phong?

Doesn’t matter, they look slightly different but they’re both hacks

Illumination Models: Blinn-Phong

46 of 56

-

Page 47: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

Look closely at the specular term: We can compute this term recursively

shoot a ray from eye through a pixel on the screen calculate intersections of ray with all primitives in the scene, pick the

closest one shoot a specular reflection ray (equal and opposite angle) from the

intersection point to closest object to calculate its specular contribution. Spawn a secondary specular ray, etc.

apply our simple illumination model at every intersection point, accounting for direct contribution from non-occluded lights, and indirect specular contributions from nearest objects

can even be done realtime in hardware thanks to modern GPU’s

Simple global model that only computes specular inter-object reflection, but can be extended for diffuse effects

You will be implementing the simple RRT soon; see next lecture

Illumination Models: Computing Results – sneak peak at Recursive Ray Tracing

𝑘𝑠𝑂𝑠 𝜆 (𝐑 ⋅𝐕 )𝛼

47 of 56October 22, 2015 Images: http://www.ignorancia.org/en/index.php?page=Patiohttp://www.247-lasereyesurgery.info/wp-content/uploads/2013/08/img_3.jpg

Page 48: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? Local vs. Global Illumination The Rendering Equation Illumination vs. Shading Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

48 of 56

Page 49: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

We define a normal at each polygon (not at each vertex)

Lighting: Evaluate the lighting equation at the center of each polygon using the associated normal

Shading: Each sample point on the polygon is given the interpolated lighting value at the vertices (i.e., a total hack)

Shading Models – Flat/Constant (Review)

49 of 56

Page 50: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Define a normal vector at each vertex

Lighting: Evaluate lighting equation at each vertex using associated normal vector

Shading: Each sample point’s color on polygon is interpolated from color values at polygon’s vertices

Shading Models – Gouraud (Review)

An issue with Gouraud shading is that specular highlights appear to “jump” as the object rotates. Simple fix is to increase polygon count, at cost of much more computation.

50 of 56

Page 51: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

Each vertex has an associated normal vector

Lighting: Evaluate lighting equation at each vertex using associated normal vector

Shading: For every sample point on polygon we interpolate normals at vertices of the polygon and compute color using lighting equation with the interpolated normal at each interior pixel – more accurate representation of true surface normal at each point (and we don’t get moving specular highlights)

Shading Models – Phong (Review)

51 of 56

Page 52: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

What is Light? The Rendering Equation Illumination vs. Shading Local vs. Global Illumination Computing Illumination Modeling Reflectance Illumination Models Shading Models Advanced Global

Illumination Techniques

Outline

52 of 56

Page 53: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

CS123 | INTRODUCTION TO COMPUTER GRAPHICS

Andries van Dam©

October 22, 2015

In practice, calculating global illumination for a scene is a very complex and computationally intensive task

Many algorithms (both real time and non real time) have been developed to calculate or approximate global illumination

Real time

Ambient occlusion, image based lighting, path tracing

Not (yet) real time

Radiosity, Metropolis light transport, photon mapping, point based color bleeding

Advanced Global Illumination Techniques

53 of 56

Page 54: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

Andries van Dam©

Advanced GI Techniques

Photon Mapping

Mental Ray RendererBioshock 2

Determine amount of light at a point by sending packets of energy (photons) from each light source out into the scene and counting how many are around that point.

Advanced GlobalIllumination Techniques

Real Time Global Illumination

Snowdrop RendererTom Clancy’s The Division

Uses Deferred Radiance Transfer Volumes and Volumetric lighting to create real time global illumination , including shadows, light filtering through bullet holes, and changes in environmental light sources due to player actions.

TechnologyTrailer

54 of 56

avd
Very nice image, but not a clue as to what techniques they are using – can you find out?
Page 55: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

Andries van Dam©

Advanced GI Techniques

Point-Based Color Bleeding

Renderman RendererUp!

First generates a direct illumination point cloud. Uses the point cloud for lookup during rendering to approximate diffuse light bounces by adding up the contribution from other points in the cloud.

Advanced Global Illumination Techniques

Ray Bundling

Hyperion RendererBig Hero 6

At each step of raytracing, bundle similar rays into groups and treat them as a wave of rays. This reduces the computation of each step, and allows for many more iterations, creating better illuminated scenes.

Technology 55 of 56

avd
i will preview raytracing in Realism with a single slide, so this is ok
Page 56: CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © October 22, 20151 of 56 Illumination and Light Transport Chapters 26, 29, 31, 33 Cornell box

Andries van Dam©

Advanced GI Techniques

Image Based Lighting

Sunflow RendererShiny Aliens

Plot an image onto a dome or sphere, using the lighting properties of this surface to determine global illumination when rendering the scene.

Advanced Global Illumination Techniques

Voxel Global Illumination (VXGI)

Maxwell Renderer

Break scene into voxels using an algorithm similar to an octree. Rather than using original geometry, voxel approximation can be used to efficiently calculate ambient occlusion and interreflections.

Technology

More Images56 of 56