computer graphics & visualization photon mapping

30
computer graphics & visualization Image Synthesis Photon Mapping

Upload: mark-griffith

Post on 03-Jan-2016

272 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis

Photon Mapping

Page 2: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Motivation

“Today ray tracing is one of the most popular and powerful techniques in the image synthesis repertoire: it is simple, elegant, and easily implemented. [However] there are some aspects of the real world that ray tracing doesn’t handle very well (or at all!) as of this writing. Perhaps the most important omissions are diffuse inter-reflections (e.g. the ‘bleeding’ of colored light from a dull red file cabinet onto a white carpet, giving the carpet a pink tint), and caustics (focused light, like the shimmering waves at the bottom of a swimming pool).”

Andrew Glassner 1989

Page 3: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

OverviewGenerating a Photon Mapped Image:

Two pass approach1. Generate Photon Map

“from the light source into the scene”

2. Render Image; e.g. with ray tracing“from the eye into the scene”

Page 4: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Ray tracing• The basic ray-tracing method– Recursive search for paths to the light source

• Interaction with matter• Point-wise evaluation of an illumination model• Shadows, reflection, transparency

ViewpointPoint light

source

R2

R1

R3

N2

N1

N3

T1

T2

L2 L1

L3

N: surface normals R: reflected rays L: shadow rays T: transmitted rays

Page 5: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Light sourcesTypes of light sources

Point Spherical Area General

Page 6: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

From light source into the scene

Point light source

R2

R1

R3

N2

N1

N3

T1

T2

L3

Photon Map entries

Page 7: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Excursion: Path tracingSo far „recursive Raytracing“

Eye

Reflection

Reflection

Reflection

Refraction

Refraction

Reflection

Refraction

Refraction

Reflection

Reflection

Refraction

Refraction

Reflection

Refraction

“wastes most computationson little contribution”

Page 8: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

New idea: „Path Tracing“Consider only a single path through the tree at a time

... and use Russian roulette to compute multiple paths

Eye

Reflection

Reflection

Reflection

Refraction

Refraction

Reflection

Refraction

Refraction

Reflection

Reflection

Refraction

Refraction

Reflection

Refraction

Page 9: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Back to Photons

[1,[[,[[,0[ absorbtionfor y Propabilit)(1 reflectionspecular for y Propabilit reflection diffusefor y Propabilitdsdsdddssd

N1

N1

N1

Page 10: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Why path-tracing for photons?

e

lightphoton n

PP

Constant photon energy

Well defined number of Photons in map

Problem: Aliasing

Page 11: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Aliasing/Noise

Page 12: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

What to store in the photon map?

struct photon { float x,y,z; // position char phi, theta; // incident direction char p[4]; // color}

// phi = 255 * (atan2(dy,dx)+PI) / (2*PI);// theta = 255 * acos(dx) / PI;

Page 13: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

How to store photons?• in a list / an array– simple– search operations O(n)

• in a grid– memory intense– search operations O(1)

• in a tree / kd-Tree– memory efficient– search operations O(log n)

Page 14: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

A “balanced” kd-TreepointList = [(2,3), (5,4), (9,6), (4,7), (8,1), (7,2)] tree = kdtree(pointList)

Page 15: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

KD-Tree Example

Page 16: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Pass 1 Shooting: Summary• For every light source– For a given number of photons• Choose random position (not for point lights)• Choose random direction• Start path tracing from light source• Stop in diffuse or absorbtion cases

– If diffuse: store position and direction in list

• Convert list to kd-tree

Page 17: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Pass 2 RenderingPhoton Map per se can not be rendered

Page 18: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Gathering

n

p

iirprrer

i

iirirrer

ii

iii

iirirrer

A

xxfxLxL

dA

xdxfxLxL

dAd

xdxL

dyLxfxLxL

1

2

2

),(),,(),(),(

),(),,(),(),(

)cos(

),(),(

)cos(),(),,(),(),(

Page 19: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Radiance Estimate

n

piirprrer

n

p

iirprrer

xxfr

xLxL

rA

A

xxfxLxL

1

1

),(),,(2

1),(),(

2

),(),,(),(),(

Page 20: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Splitting up the RE

iidridr

iicridr

iidicrisr

iirir

iirirr

dyLxf

dyLxf

dyLyLxf

dyLxf

dyLxfxL

)cos(),(),,(

)cos(),(),,(

)cos(),(),(),,(

)cos(),(),,(

)cos(),(),,(),(

,

,

,

Direct illumination from LS

Specular from caustics and diffuse illumination

Diffuse from caustics illumination

Diffuse from diffuse incoming illumination

indirectcausticsspeculardirectr LLLLL

Page 21: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Splitting up the RE

Raytracing: Shadow Caster

iidridr

iicridr

iidicrisr

iirir

iirirr

dyLxf

dyLxf

dyLyLxf

dyLxf

dyLxfxL

)cos(),(),,(

)cos(),(),,(

)cos(),(),(),,(

)cos(),(),,(

)cos(),(),,(),(

,

,

,

Direct illumination from LS

Specular from caustics and diffuse illumination

Diffuse from caustics illumination

Diffuse from diffuse incoming illumination

Page 22: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Splitting up the RE

Raytracing: Shadow Caster

Raytracing: Monte-Carlo Raytracing

iidridr

iicridr

iidicrisr

iirir

iirirr

dyLxf

dyLxf

dyLyLxf

dyLxf

dyLxfxL

)cos(),(),,(

)cos(),(),,(

)cos(),(),(),,(

)cos(),(),,(

)cos(),(),,(),(

,

,

,

Direct illumination from LS

Specular from caustics and diffuse illumination

Diffuse from caustics illumination

Diffuse from diffuse incoming illumination

Page 23: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Splitting up the RE

Raytracing: Shadow Caster

Raytracing: Monte-Carlo Raytracing

Photon Map: Direct Radiance Estimate

iidridr

iicridr

iidicrisr

iirir

iirirr

dyLxf

dyLxf

dyLyLxf

dyLxf

dyLxfxL

)cos(),(),,(

)cos(),(),,(

)cos(),(),(),,(

)cos(),(),,(

)cos(),(),,(),(

,

,

,

Direct illumination from LS

Specular from caustics and diffuse illumination

Diffuse from caustics illumination

Diffuse from diffuse incoming illumination

Page 24: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Splitting up the RE

iidridr

iicridr

iidicrisr

iirir

iirirr

dyLxf

dyLxf

dyLyLxf

dyLxf

dyLxfxL

)cos(),(),,(

)cos(),(),,(

)cos(),(),(),,(

)cos(),(),,(

)cos(),(),,(),(

,

,

,

Raytracing: Shadow Caster

Raytracing: Monte-Carlo Raytracing

Photon Map: Direct Radiance Estimate

Photon Map: Indirect Radiance Estimate

Direct illumination from LS

Specular from caustics and diffuse illumination

Diffuse from caustics illumination

Diffuse from diffuse incoming illumination

Page 25: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Irradiance CacheInstead of computing the Indirect Radiance Estimate, compute the irradiance ofa given pixel from the irradiance values of its neighbors; „if possible“.

Page 26: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Results

Page 27: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Problems

Page 28: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Disc Sampling

Page 29: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

More Images

1 000 000 Photons, 100 Photons for radiance estimate, 11 Minutes

Page 30: Computer graphics & visualization Photon Mapping

computer graphics & visualization

Image Synthesis – WS 07/08Dr. Jens Krüger – Computer Graphics and Visualization Group

Realtime Photon tracing on GPUs0.05 Seconds

http://wwwcg.in.tum.de/Research/Publications/Photons/