11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois...

72
11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois y slides from Debevec, some from Efros T2

Transcript of 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois...

Page 1: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

11/18/10

Image-based Lighting (Part 2)

Computational PhotographyDerek Hoiem, University of Illinois

Many slides from Debevec, some from Efros

T2

Page 2: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Today

• Brief review of last class

• Show how to get an HDR image from several LDR images, and how to display HDR

• Show how to insert fake objects into real scenes using environment maps

Page 3: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

How to render an object inserted into an image?

Page 4: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

How to render an object inserted into an image?

Traditional graphics way• Manually model BRDFs of all room surfaces• Manually model radiance of lights• Do ray tracing to relight object, shadows, etc.

Page 5: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

How to render an object inserted into an image?

Image-based lighting• Capture incoming light with a

“light probe”• Model local scene• Ray trace, but replace distant

scene with info from light probe

Debevec SIGGRAPH 1998

Page 6: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Key ideas for Image-based Lighting• Environment maps: tell what light is entering

at each angle within some shell

+

Page 7: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Cubic Map Example

Page 8: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Spherical Map Example

Page 9: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Key ideas for Image-based Lighting• Light probes: a way of capturing environment

maps in real scenes

Page 10: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Mirrored SphereMirrored Sphere

Page 11: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.
Page 12: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

One small snag• How do we deal with light sources? Sun, lights, etc?

– They are much, much brighter than the rest of the environment

• Use High Dynamic Range photography!

1

46

1907

15116

18

.

..

.

.Relative

Brightness

Page 13: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Key ideas for Image-based Lighting• Capturing HDR images: needed so that light

probes capture full range of radiance

Page 14: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Problem: Dynamic RangeProblem: Dynamic Range

Page 15: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Long ExposureLong Exposure

10-6 106

10-6 106

Real world

Picture

0 to 255

High dynamic range

Page 16: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Short ExposureShort Exposure

10-6 106

10-6 106

Real world

Picture

High dynamic range

0 to 255

Page 17: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Recovering High Dynamic RangeRadiance Maps from PhotographsRecovering High Dynamic RangeRadiance Maps from Photographs

Paul DebevecJitendra MalikPaul DebevecJitendra Malik

August 1997August 1997

Computer Science DivisionUniversity of California at Berkeley

Computer Science DivisionUniversity of California at Berkeley

Page 18: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Ways to vary exposureWays to vary exposure Shutter Speed (*)

F/stop (aperture, iris)

Neutral Density (ND) Filters

Shutter Speed (*)

F/stop (aperture, iris)

Neutral Density (ND) Filters

Page 19: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Shutter SpeedShutter Speed

Ranges: Canon D30: 30 to 1/4,000 sec.

Sony VX2000: ¼ to 1/10,000 sec.

Pros:• Directly varies the exposure• Usually accurate and repeatable

Issues:• Noise in long exposures

Ranges: Canon D30: 30 to 1/4,000 sec.

Sony VX2000: ¼ to 1/10,000 sec.

Pros:• Directly varies the exposure• Usually accurate and repeatable

Issues:• Noise in long exposures

Page 20: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

The Approach• Get pixel values Zij for image with shutter time Δtj (ith

pixel location, jth image)• Exposure is radiance integrated over time:

• To recover radiance Ri, we must map pixel values to log exposure: ln(Eij)= g(Zij)

• Solve for R, g by minimizing:

jiijjiij tREtRE lnlnln

max

min

Z

Zz

N

i

P

jijjiij zgzwZgtRZw 2

1 1

2 )()()(lnln)(

Page 21: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

The objective

Solve for radiance R and mapping g for each of 255 pixel values to minimize:

max

min

Z

Zz

N

i

P

jijjiij zgzwZgtRZw 2

1 1

2 )()()(lnln)(

give pixels near 0 or 255 less weight

known shutter time for image j

radiance at particular pixel site is the same for each image

exposure should smoothly increase as pixel intensity increases

exposure, as a function of pixel value

Page 22: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Matlab Code

Page 23: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Matlab Codefunction [g,lE]=gsolve(Z,B,l,w)

n = 256;A = zeros(size(Z,1)*size(Z,2)+n+1,n+size(Z,1));b = zeros(size(A,1),1);

k = 1; %% Include the data-fitting equationsfor i=1:size(Z,1) for j=1:size(Z,2) wij = w(Z(i,j)+1); A(k,Z(i,j)+1) = wij; A(k,n+i) = -wij; b(k,1) = wij * B(i,j); k=k+1; endend

A(k,129) = 1; %% Fix the curve by setting its middle value to 0k=k+1;

for i=1:n-2 %% Include the smoothness equations A(k,i)=l*w(i+1); A(k,i+1)=-2*l*w(i+1); A(k,i+2)=l*w(i+1); k=k+1;end

x = A\b; %% Solve the system using SVD

g = x(1:n);lE = x(n+1:size(x,1));

Page 24: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

• 3• 3

• 1• 1 •

2• 2

Dt =1 sec

• 3• 3

• 1• 1 •

2• 2

Dt =1/16 sec

• 3• 3

• 1• 1

• 2• 2

Dt =4 sec

• 3• 3

• 1• 1 •

2• 2

Dt =1/64 sec

IllustrationIllustration

Image seriesImage series

• 3• 3

• 1• 1 •

2• 2

Dt =1/4 sec

Exposure = Radiance ´ DtExposure = Radiance ´ Dtlog Exposure = log Radiance + log Dtlog Exposure = log Radiance + log Dt

Pixel Value Z = f(Exposure)Pixel Value Z = f(Exposure)

Page 25: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Response CurveResponse Curve

ln Exposureln Exposure

Assuming unit radiancefor each pixel

Assuming unit radiancefor each pixel

After adjusting radiances to obtain a smooth response

curve

After adjusting radiances to obtain a smooth response

curve

Pix

el v

alue

Pix

el v

alue

33

11

22

ln Exposureln Exposure

Pix

el v

alue

Pix

el v

alue

Page 26: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Results: Digital CameraResults: Digital Camera

Recovered response curve

log Exposure

Pix

el v

alue

Kodak DCS4601/30 to 30 sec

Page 27: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Reconstructed radiance map

Page 28: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Results: Color FilmResults: Color Film• Kodak Gold ASA 100, PhotoCD• Kodak Gold ASA 100, PhotoCD

Page 29: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Recovered Response CurvesRecovered Response Curves

Red Green

RGBBlue

Page 30: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

How to display HDR?

How to display HDR?

Linearly scaled todisplay device

Page 31: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Global Operator (Reinhart et al)Global Operator (Reinhart et al)

world

worlddisplay L

LL

1

Page 32: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Global Operator ResultsGlobal Operator Results

Page 33: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Darkest 0.1% scaledto display device

Reinhart Operator

Page 34: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

What do we see?What do we see?

Vs.

Page 35: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Acquiring the Light ProbeAcquiring the Light Probe

Page 36: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Assembling the Light ProbeAssembling the Light Probe

Page 37: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Real-World HDR Lighting Environments

Lighting Environments from the Light Probe Image Gallery:http://www.debevec.org/Probes/Lighting Environments from the Light Probe Image Gallery:http://www.debevec.org/Probes/

FunstonBeach

UffiziGallery

EucalyptusGrove

GraceCathedral

Page 38: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Illumination ResultsIllumination Results

Page 39: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Comparison: Radiance map versus single imageComparison: Radiance map versus single image

HDR

LDR

Page 40: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

CG Objects Illuminated by a Traditional CG Light Source

CG Objects Illuminated by a Traditional CG Light Source

Page 41: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Illuminating Objects using Measurements of Real LightIlluminating Objects using Measurements of Real Light

ObjectObject

LightLight

http://radsite.lbl.gov/radiance/http://radsite.lbl.gov/radiance/

Environment assigned “glow”

material property inGreg Ward’s RADIANCE system.

Environment assigned “glow”

material property inGreg Ward’s RADIANCE system.

Page 42: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Paul Debevec. A Tutorial on Image-Based Lighting. IEEE Computer Graphics and Applications, Jan/Feb 2002.Paul Debevec. A Tutorial on Image-Based Lighting. IEEE Computer Graphics and Applications, Jan/Feb 2002.

Page 43: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Rendering with Natural LightRendering with Natural Light

SIGGRAPH 98 Electronic Theater

Page 44: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Movie• http://www.youtube.com/watch?v=EHBgkeXH9lU

Page 45: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Illuminating a Small SceneIlluminating a Small Scene

Page 46: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.
Page 47: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

We can now illuminatesynthetic objects with real light.- Environment map- Light probe- HDR- Ray tracing

How do we add synthetic objects to a real scene?

Page 48: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Real Scene ExampleReal Scene Example

Goal: place synthetic objects on tableGoal: place synthetic objects on table

Page 49: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Light Probe / Calibration Grid

Page 50: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

real scenereal scene

Modeling the SceneModeling the Scene

light-based modellight-based model

Page 51: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

The Light-Based Room ModelThe Light-Based Room Model

Page 52: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

real scenereal scene

Modeling the SceneModeling the Scene

synthetic objectssynthetic objects

light-based modellight-based model

local scenelocal scene

Page 53: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

The Lighting ComputationThe Lighting Computation

synthetic objects(known BRDF)

synthetic objects(known BRDF)

distant scene (light-based, unknown BRDF)distant scene (light-based, unknown BRDF)

local scene(estimated BRDF)

local scene(estimated BRDF)

Page 54: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Rendering into the SceneRendering into the Scene

Background PlateBackground Plate

Page 55: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Rendering into the SceneRendering into the Scene

Objects and Local Scene matched to SceneObjects and Local Scene matched to Scene

Page 56: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Differential Rendering Difference in local sceneDifferential Rendering Difference in local scene

-- ==

Page 57: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Differential RenderingDifferential Rendering

Final ResultFinal Result

Page 58: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

IMAGE-BASED LIGHTING IN FIAT LUXPaul Debevec, Tim Hawkins, Westley Sarokin, H. P. Duiker, Christine Cheng, Tal Garfinkel, Jenny Huang

SIGGRAPH 99 Electronic Theater

Page 59: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Fiat Lux• http://ict.debevec.org/~debevec/FiatLux/movie/• http://ict.debevec.org/~debevec/FiatLux/technology/

Page 60: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.
Page 61: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

HDR Image SeriesHDR Image Series

2 sec2 sec 1/4 sec1/4 sec 1/30 sec1/30 sec

1/250 sec1/250 sec 1/2000 sec1/2000 sec 1/8000 sec1/8000 sec

Page 62: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Stp1 PanoramaStp1 Panorama

Page 63: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Assembled PanoramaAssembled Panorama

Page 64: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Light Probe ImagesLight Probe Images

Page 65: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Capturing a Spatially-Varying Lighting EnvironmentCapturing a Spatially-Varying Lighting Environment

Page 66: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

What if we don’t have a light probe?

Insert Relit Face

Zoom in on eye

Environment map from eye

http://www1.cs.columbia.edu/CAVE/projects/world_eye/ -- Nishino Nayar 2004

Page 67: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.
Page 68: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Environment Map from an Eye

Page 69: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Can Tell What You are Looking At

Eye Image:

Computed Retinal Image:

Page 70: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.
Page 71: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Summary• Real scenes have complex

geometries and materials that are difficult to model

• We can use an environment map, captured with a light probe, as a replacement for distance lighting

• We can get an HDR image by combining bracketed shots

• We can relight objects at that position using the environment map

Page 72: 11/18/10 Image-based Lighting (Part 2) Computational Photography Derek Hoiem, University of Illinois Many slides from Debevec, some from Efros T2.

Have a good break!• Next class – computational cameras (really!)