24
Efficient Importance Efficient Importance Sampling Sampling Techniques for the Techniques for the Photon Map Photon Map Ingo Wald Ingo Wald University of Saarbrücken University of Saarbrücken Alexander Keller Alexander Keller University of Kaiserslautern University of Kaiserslautern

Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Embed Size (px)

Citation preview

Page 1: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Efficient Importance SamplingEfficient Importance SamplingTechniques for theTechniques for the

Photon MapPhoton Map

Ingo WaldIngo WaldUniversity of SaarbrückenUniversity of Saarbrücken

Alexander KellerAlexander KellerUniversity of KaiserslauternUniversity of Kaiserslautern

Page 2: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

OutlineOutline

• Overview: The Photon Map methodOverview: The Photon Map method

• New importance sampling techniques for the New importance sampling techniques for the Photon MapPhoton Map– Probabilistic photon depositionProbabilistic photon deposition– Automatic caustic generationAutomatic caustic generation– Faster direct illumination computationFaster direct illumination computation

• SummarySummary

Page 3: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

The Photon Map (Jensen,’95-’98)The Photon Map (Jensen,’95-’98)

• Basic idea : Density estimation with a discrete Basic idea : Density estimation with a discrete density of photonsdensity of photons

2-step algorithm2-step algorithm– Photon generation stagePhoton generation stage

• Emit photons on light sourcesEmit photons on light sources

• Random walk (trace photons through scene)Random walk (trace photons through scene)

• Store interactions (position x, power phi, …)Store interactions (position x, power phi, …)– Rendering : Modified distribution ray tracingRendering : Modified distribution ray tracing

• Approximate radiance by density estimationApproximate radiance by density estimation

• Query k nearest photonsQuery k nearest photons

• Density estimation: radiance = sumOfEnergies/coveredAreaDensity estimation: radiance = sumOfEnergies/coveredArea

• Estimate too coarse to be visualized directly Estimate too coarse to be visualized directly Use only indirectly (final gather) Use only indirectly (final gather)

Page 4: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Photon GenerationPhoton Generation

• Original algorithm: Pure forward simulationOriginal algorithm: Pure forward simulationVisual importance not taken into accountVisual importance not taken into account Photon density is high (only) where illumination is highPhoton density is high (only) where illumination is high

Problematic whenever photon density doesn’t Problematic whenever photon density doesn’t match importance distributionmatch importance distribution– High density (high cost) in unimportant regionsHigh density (high cost) in unimportant regions– Low density (low quality) in important regionLow density (low quality) in important region

Page 5: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Bad Importance Distribution - ExamplesBad Importance Distribution - Examples

importancedistribution

photondistribution

Page 6: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Bad Importance Distribution - ExamplesBad Importance Distribution - Examples

importancedistribution

photondistribution

Page 7: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Importance Driven Photon MapsImportance Driven Photon Maps

• Photon generation stage is relatively cheapPhoton generation stage is relatively cheap Invest more time in photon generation to improve renderingInvest more time in photon generation to improve rendering

• Goal : Concentrate photons in important regionsGoal : Concentrate photons in important regions Two approaches :Two approaches :

• Guide photons to important regions (Peter, Pietrek, ‘98)Guide photons to important regions (Peter, Pietrek, ‘98)

• Discard unimportant photonsDiscard unimportant photons

• Guiding photons often problematicGuiding photons often problematic– Fails for highly improbable light pathsFails for highly improbable light paths– Generates noise in photon energies (Generates noise in photon energies ( artifacts) artifacts)

Our approach: Discard unimportant photonsOur approach: Discard unimportant photons Probabilistic photon depositionProbabilistic photon deposition– Similar work : Suykens at al, EGWR 2000Similar work : Suykens at al, EGWR 2000

Page 8: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon DepositionProbabilistic Photon Deposition

• Initialization stage : Approximate importanceInitialization stage : Approximate importance– Shoot ‘importons’ from camera into sceneShoot ‘importons’ from camera into scene– Store in separate importance mapStore in separate importance map

• Photon tracing stagePhoton tracing stage– Generate deposition probability P for each new photonGenerate deposition probability P for each new photon

• Based on importance of photon locationBased on importance of photon location

• Approximate importance with density estimationApproximate importance with density estimation– Stochastically discard unimportant photonsStochastically discard unimportant photons

• Discard with probability (1-P)Discard with probability (1-P)

• On acceptance : Deposit photon with new energy phi/POn acceptance : Deposit photon with new energy phi/P– Make sure that P = 1 in important regions Make sure that P = 1 in important regions

No noise in photon energiesNo noise in photon energies

UnbiasedUnbiased

Page 9: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon Deposition - ResultsProbabilistic Photon Deposition - Results

Efficiently discards unimportant photonsEfficiently discards unimportant photons

Page 10: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon Deposition - ResultsProbabilistic Photon Deposition - Results

Efficiently discards unimportant photonsEfficiently discards unimportant photons

importancedistribution

photons, notimportance driven

Comparison at same number of traced photons :

Page 11: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon Deposition - ResultsProbabilistic Photon Deposition - Results

Efficiently discards unimportant photonsEfficiently discards unimportant photons

importancedistribution

photons, notimportance driven

photons,importance driven

Comparison at same number of traced photons :

Page 12: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon Deposition - ResultsProbabilistic Photon Deposition - Results

importancedistribution

photonsold method

photons,importance driven

Comparison at same number of stored photons :

Page 13: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon Deposition - ResultsProbabilistic Photon Deposition - Results

importancedistribution

photonsold method

photons,importance driven

Comparison at same number of stored photons :

without importance importance driven

Impact on final image (same number of stored photons)

Page 14: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Probabilistic Photon DepositionProbabilistic Photon Deposition

Two ways to look at results:Two ways to look at results:

““Emit same number of photons” Emit same number of photons” – Same quality (no important photons are discarded)Same quality (no important photons are discarded)– Less photons during rendering phaseLess photons during rendering phase

• less storageless storage

““Same number of photons during rendering”Same number of photons during rendering”– Higher photon tracing cost (often small compared to rendering)Higher photon tracing cost (often small compared to rendering)– Better quality Better quality

• all photons are importantall photons are important

• higher density in important regionshigher density in important regions– Often only way to reach required density if total number of Often only way to reach required density if total number of

photons is limited (available memory)photons is limited (available memory)

Page 15: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Automatic Caustic GenerationAutomatic Caustic Generation

• Problem: Caustics need higher photon density Problem: Caustics need higher photon density – Final gather only works for diffuse indirect illuminationFinal gather only works for diffuse indirect illumination Caustics have to be visualized directly (artifacts)Caustics have to be visualized directly (artifacts) Higher density requiredHigher density required

• Jensen: Shoot caustic photons separatelyJensen: Shoot caustic photons separately– Shoot directly to caustic generating objectsShoot directly to caustic generating objects Generates Generates onlyonly directdirect causticscaustics

• Our approach : Our approach : Extend importance driven photon depositionExtend importance driven photon deposition– Trace S times as many photonsTrace S times as many photons Discard non-caustics photons with probability (S-1)/SDiscard non-caustics photons with probability (S-1)/S

Page 16: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Automatic Caustic GenerationAutomatic Caustic Generation

ResultsResults– Photon generation S (typically 5-20) times as costlyPhoton generation S (typically 5-20) times as costly

(Still often small compared to total rendering time)(Still often small compared to total rendering time)– Increases caustic density by factor SIncreases caustic density by factor S– Automatically generates indirect causticsAutomatically generates indirect caustics

Page 17: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Automatic Caustic GenerationAutomatic Caustic Generation

ResultsResults– Photon generation S (typically 5-20) times as costlyPhoton generation S (typically 5-20) times as costly

(Still often small compared to total rendering time)(Still often small compared to total rendering time)– Increases caustic density by factor SIncreases caustic density by factor S– Automatically generates indirect causticsAutomatically generates indirect caustics

original caustic density

Page 18: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Automatic Caustic GenerationAutomatic Caustic Generation

ResultsResults– Photon generation S (typically 5-20) times as costlyPhoton generation S (typically 5-20) times as costly

(Still often small compared to total rendering time)(Still often small compared to total rendering time)– Increases caustic density by factor SIncreases caustic density by factor S– Automatically generates indirect causticsAutomatically generates indirect caustics

original caustic density higher caustic density (S=20)

Page 19: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Direct IlluminationDirect Illumination

• Direct illumination calculated separately Direct illumination calculated separately – Photon Map estimate too coarsePhoton Map estimate too coarse

Monte Carlo sampling of light sourcesMonte Carlo sampling of light sources– Send shadow rays to each light sourceSend shadow rays to each light source

Very expensive for lots of light sources Very expensive for lots of light sources– Real scenes: Large fraction of lights often occludedReal scenes: Large fraction of lights often occluded

Sampling all sources equally is inefficient Sampling all sources equally is inefficient

Importance samplingImportance sampling Shoot more samples to ‘important’ light sourcesShoot more samples to ‘important’ light sources

Page 20: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Importance Driven Direct IlluminationImportance Driven Direct Illumination

• Photon driven direct illumination computationPhoton driven direct illumination computation– Estimate light source importances with Photon MapEstimate light source importances with Photon Map

• Rough estimate is enough for importance samplingRough estimate is enough for importance sampling

• Tag direct photons with light source idTag direct photons with light source id– Rendering: Estimate contribution from each light sourceRendering: Estimate contribution from each light source

• Based on k nearest direct photonsBased on k nearest direct photons– Select number of shadow rays per light source relative to Select number of shadow rays per light source relative to

that light source’s importancethat light source’s importance

• Missing light sourcesMissing light sources– Light source may ‘by chance’ not contribute a photonLight source may ‘by chance’ not contribute a photon

ArtifactsArtifacts– Highly improbable if query radius is large enoughHighly improbable if query radius is large enough

Page 21: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Importance Driven Direct IlluminationImportance Driven Direct Illumination

Efficiently excludes unimportant light sourcesEfficiently excludes unimportant light sources Significantly less shadow raysSignificantly less shadow rays

• Better quality at same rendering timeBetter quality at same rendering time

Page 22: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Importance Driven Direct IlluminationImportance Driven Direct Illumination

Efficiently excludes unimportant light sourcesEfficiently excludes unimportant light sources Significantly less shadow raysSignificantly less shadow rays

• Better quality at same rendering timeBetter quality at same rendering time

Comparison at identical rendering times:

original method importance driven

Page 23: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

SummarySummary

Presented three new extensions to the Photon MapPresented three new extensions to the Photon Map

• Importance driven photon depositionImportance driven photon deposition– Makes complex scenes tractableMakes complex scenes tractable

• Automatic caustic generationAutomatic caustic generation– Can generate indirect causticsCan generate indirect caustics

• Importance driven direct illuminationImportance driven direct illumination– Much faster for lots of light sources with varying importanceMuch faster for lots of light sources with varying importance

Page 24: Efficient Importance Sampling Techniques for the Photon Map Ingo Wald University of Saarbrücken Alexander Keller University of Kaiserslautern

Questions ?Questions ?