<<

Imp ortance Driven Path Tracing

using the Photon Map

Henrik Wann Jensen

Dept of Graphical Communication

Technical University of Denmark

Abstract This pap er presents a new imp ortance sampling strategy for

Monte Carlo in which a rough estimate of the irradiance

based on the photon map is combined with the lo cal reection mo del to

construct more ecient probabili ty density functions that can b e used

in an imp ortance sampling scheme

The algorithm gives unbiased results handles arbitrary reection mo dels

and it is particularly ecient in scenes with highly nonuniform indirect

illuminati on Initial results and comparisons with traditional imp ortance

sampling strategies indicate a reduction in the noise level of more than

Key Words Path Tracing Imp ortance Sampling Photon

Map

Intro duction

Photorealistic rendering requires accurate simulation of global illumination and

muchwork has b een done in this area in the last years The problem was

actually solved in byKajiya using a metho d called path tracing This

metho d is basically a brute force Monte Carlo simulation of lightinteraction

with a given mo del Path tracing is very general and it can b e applied to ar

bitrarilly complex mo dels It requires only small amounts of memory and it is

very applicable to parallel computers The rendering time with path tracing is

however so enormous that the metho d in spite of b eing general is not very

attractive on current computers architectures

Several pap ers have presented improvements to the path tracing metho d

Ward et al did a very go o d job byintro ducing a caching scheme in

h indirect illumination is stored and reused at ideal diuse surfaces This whic

signicantly reduces the number of rays necessary in scenes with many at ideal

diuse surfaces Shirley et al andWard reduce the numb er of shadow

rays required to compute direct illumination in scenes with manylight sources

Arvo et al describ ed a technique called Russian roulette that eliminates the

email igkhwjunidhpuni cdk url httpwwwgkdtudkhomehwj

innite reection of lightrays without intro ducing bias in the nal solution Se

veral authors use imp ortance sampling where the reection characteristics

of the surface are used to guide sampling rays into those directions from where

the light will contribute mostly Another approach is adaptive sampling where

samples are concentrated in the most interesting parts of the scene Lafortune et

al constructs a d tree representing the overall ux in the scene and uses this

tree in the selection of new sampling directions Adaptive sampling can however

easily lead to biased solutions and it must b e used with great care Recently

bidirectional path tracing was intro duced by Lafortune et al and Veachet

al It is a mixture of path tracing from the eye and path tracing from the

light sources and it is particularly ecient in scenes with highly nonuniform

indirect illumination

Currently the simulation of global illumination is obtained most eciently

by the two pass metho ds in which a light pass ie radiosity pro duces a solution

that is visualized with a simplied path tracing algorithm

Another ecient metho d or collection of metho ds is presented in the Radiance

rendering program byWard

These two pass metho ds and the Radiance program do however degrade to

pure path tracing in very complex environments where the surfaces are no longer

ideal diuse or ideal sp ecular or where the ob jects are either to o complex or to o

many to b e represented by p olygons Even though some of the two pass metho ds

can let the light pass step work on simplied scenes they still haveto

visualize the solution using path tracing in order to eliminate artifacts in the

light pass step This path tracing step do es not utilize the fact that the mo del

t and the imp ortance do es contain information on the distribution of the ligh

sampling is therefore still only using the reection characteristics of the surface

to guide new sampling rays

This is particularly problematic in scenes with highly nonuniform indirect

illumination These situation are handled more eciently using bidirectional

path tracing but this metho d do es not use the irradiance stored within the

mo del It would b e more appropriate to use the information created in the light

pass to guide the path tracing algorithm This would also p ermit the use of

the metho d in twopasstechniques where path tracing is used only for the rst

reection seen bytheeye

In this pap er we present an imp ortance sampling scheme in which the scene is

prepro cessed and rough estimates of the incoming light are created everywhere in

the mo del These rough estimates are used to generate sampling directions based

on probability density functions that more closely ts the true light contribution

as opp osed to standard imp ortance sampling metho ds which only use the lo cal

reection mo del

In this waywe concentrate the samples in the imp ortant parts of the scene

This approachdoesnotgiveany bias on the nal solution as opp osed to some

of the common adaptive strategies that also tries to put more samples into

imp ortant parts of the scene

Mathematical Background

Given the integral

Z

n

I g x dx x D R

Wecanevaluate this integral using a Monte Carlo technique known as the

samplemean metho d by representing the value of the integral as the ex

p ected value of any sto chastic variable X with pdf px x D suchthat

px when g x

Z

g x g x

px dx E I

px px

An estimate of the integral is obtained by taking N random sample p oints x

i

distributed according to px

N

X

g x

i

I

N px

i

i

The error on this estimate largely dep ends on the choice of px and the number

p

N of samples but as a general rule the standard deviation is prop ortional to

That is in order to halve the error wehave to quadruple the numb er of samples

Careful selection of pxcanhowever lower the error px should b e constructed

so that more samples are put into those regions where g x has the highest

absolute value It can b e shown that the optimal choice for pxis

g x

px

I

This choice gives a standard deviation of zero always Unfortunately it also

requires knowledge of I whichisthevalue we are trying to compute But in

general we can do b etter by using a pdf that lo oks like the function weare

integrating instead of just using a uniform distribution

The problem in global illumination is given in the It

expresses the radiance L reected from p osition x as

r

Z Z



d x

i i

d f x f x L x cos d L x

i r r i r r i i i i i r r

dA d

i

all all

i i

where and are the direction of the reected resp ectively incoming ra

r i

dianceux f is the BRDF at x L is the incoming radiance and is the

r i i

incoming ux

In order to solve this integral light is sampled from a numb er of discrete

directions Just sampling from random directions is in most situations very

i

inecient for a sp ecular surface only light from a small solid angle is imp ortant

and it would b e more ecient to sample within this small solid angle

Most implementations of path tracing and similar Monte Carlo based algo

rithms therefore use imp ortance sampling These implementations use the knowl

edge of f to sample those direction from where incoming light will contribute

r

mostly to the reected radiance For sp ecular surface this approachisvery e

cient since the choice of sampling direction is signicantly narrowed down This

is not the case with diuse surfaces since the entire hemisphere can contribute to

the reected radiance A pdf based on the ideal diuse BRDF is particularly

inecient when the incoming radiance L is highly nonuniform ie the incom

i

ing radiance is concentrated in small solid angles In this situation it would b e

b etter to use the optimal pdf px

r i



d

i i

px f x

r i r r i

dA d

i

Unfortunately this requires knowledge ab out the incoming ux whichisnot

i

available However even a crude estimate of can b e used to create a more

i

optimal pdf and in the following sections we will describ e a metho d in which

the photon map is used to obtain this estimate

The Photon Map

The photon map represents a distribution of photons particles throughout

the scene and it is created by emitting a large numb er of photons from each

light source into the scene based up on the emissivecharacteristics of the light

source The technique is similar to particle tracing with the exception that the

intersection p oint of each particle is stored explicitly within the scene

Each photon is traced through the scene using a strategy similar to path

tracing The rst ob ject that the photon hits gives rise to twoevents Firstly

if the surface of the ob ject is diuse the photon is stored at the intersection

point and secondly Russian roulette is used to determine whether the photon is

reected or absorb ed by the ob ject The new direction of a reected photon is

computed using the BRDF of the surface We only store the photons representing

indirect illumination ie photons that have b een reected at least once The

light sources are separated in the sampling pro cess and they should not b e part

of the irradiance estimate used to compute the pdf

The photon represents a small packet of energy arriving at a surface from a

given direction Since the numb er of photons can b e quite large wehavechosen

a relatively compact representation that o ccupies only bytes

struct photon

long energy Packed energy RGB

float position Photon position

float thetaphi Photon direction

char normal Surface normal

char key kdtree parameter

struct photon left right Rest of the kdtree

In this structure the photon energy is packed using a metho d similar to Wards

packed pixels The energy covers several wavelengths In other contexts it

might b e relevant to store energy for individual wavelengths this would also

make the name photon more correct

In the photon map we need to b e able to lo cate the n photons that havethe

shortest distance to a p oint x This can b e done quite eciently using a kdtree

Imp ortance Driven Path Tracing using the Photon Map

In the following discussion we assume that the intersection p oint x and the

reected direction are given and they are therefore omitted As shown in

r

section the optimal choice of p to select a sampling directions is

i i



d

i i i

p f

i i r i i

dA d

i

where

i i i

The existing imp ortance sampling approaches that use f as the pdf can

r

in most situations use standard transformation techniques to generate random

numb ers with the wanted distribution In it is describ ed howtocreatea

transformation function T that maps a uniform distribution of p oints u v on

the unit square onto a sampling direction We use the following notation

for describing the transformation of u v into a direction

T u v



Likewise we use the notation u v T to denote the inverse transfor

mation As an example to generate a sampling direction based on the BRDF

for an ideal diuse surface the following transformation should b e used

p

u v acos

In order to take into accountwe apply the information from the photon

i

map Likewe lo cate the N photons that have the shortest distance to x Each

photon p carries the ux in the direction note that must

ip p p p p

b e transformed from the global representation stored in the kdtree into a direc

tion compatible with the lo cal co ordinate system used at x If we assume that

all n photons intersected the surface at x then we can compute the contribution

from each photon p to the reected ux as

r

f

r r p p ip p p

To use this information in our generation of sampling directions we construct

a discrete pdf on the unit square Eachpointu v in this unit square corre

sp onds to a sampling direction T u v andeach incoming photon corresp onds to

u

v 

Fig The unit square is partitioned into distinct regions and the photon contributions

in each region are accumulated



apointu v T in the unit square For every photon wendthe

p p p p

corresp onding p oint in the unit square and we insert the photon energy at this

p osition The unit square is then partitioned into m n regions see g and

the energy in each region is accumulated Toavoid bias we eliminate all regions

with zero energy probability by adding a small fraction of the overall energy

stored within the unit square to these regions The result is an estimate of the

energy arriving from dierent sets of directions This is our pdf and it contains

alloftheelements found in equation

To use the constructed pdf we create a discrete cumulative probability

density function from the information in the unit square This is illustrated in

Cumulative

Probability



Region

Fig The accumulated energy is used in the creation of a cumulative probability

distributio n function and this function is used to select the region that contains the

new sampling direction The dashed line demonstrates how a random value is mapp ed

into a sp ecic region in unit square

g and as demonstrated in the graph this function is used to select a region

in the unit square based up on a random value The chance that a region is

selected is prop ortional to the energy accumulated in that region whichmeans

that it is more likely that we select a region ie set of incoming directions

that contributes signicantly to the reected radiance Once a region is found

we select a random p ointu v within the region and our sampling direction

becomes T u v

Due to the nonuniform sampling wehave to scale the radiance returned by

our sampling ray The scaling factor s is

Total energy in the square

s

Energy in region numb er of regions

Results and Discussion

Wehave implemented the imp ortance sampling algorithm in a program called

MIRO on a Pentium PC with MB RAM running Linux The results have b een

pro duced using a parallel implementation of the program running on the Linux

machine and Silicon Graphics workstations The implementation currently

supp orts ideal diuse ideal sp ecular rough sp ecular and anisotropic reection

mo dels The photon map has only b een incorp orated in the imp ortance sampling

algorithm for ideal diuse reection

Two test scenes have b een created Test scene is an emptyversion of the

Cornell b ox The walls in the b ox are white with the exception of the left wall

which is red and the rightwall which is green There is a small square shap ed

light source just b elow the ceiling The light source is only illuminating the

ceiling and most of the scene is therefore illuminated indirectly

The purp ose of test scene is to test the convergence sp eed of imp ortance

sampling with and without the photon map We initially computed a reference

image using samples pr pixel in the resolution x we did not use

imp ortance sampling for this computation Due to the strong indirect illumina

tion we had to use a very large numb er of samples in order to remove all visible

noise from the image

The estimate from the photon map dep ends on several parameters The num

b er of photons N used in the estimate the numberofphotons N stored in

p

the kdtree and the numb er of regions in the discrete pdf To limit the amount

of adjustable parameters we use a xed partitioning of the pdf We found that

alues of x intervals and intervals gave reasonable results with the v

N and N that we tested In general the numb er of partitions should b e increased

p

as N and N b ecome larger

p

We tested the dierent congurations by creating images using

samples pr pixel We measured the variance of the dierence b etween the com

puted images and the reference image also known as the meansquare error

MSE This value gives a go o d indication of the amount of noise presentinthe

image and since we use Monte Carlo techniques it provides a go o d measure of

the qualityofourimages NP=60000 N=50 10000 10000 Standard Standard N=10 NP=1721 N=20 NP=6892 N=50 NP=27751 N=250 NP=110422

1000 1000 MSE MSE

100 100 1 10 100 1000 1 10 100 1000

Samples pr. pixel Samples pr. pixel

a b

Fig The eect of N and N on the convergence sp eed

p

The graph in g a demonstrates how an increasing numb er of photons in

the estimate improves the quality of the computed images Using N

p

stored photons wewere able to reduce the noise in the images by increasing

N to a value of photons Increasing N beyond this valuehadonlyvery

little eect on the results The graph also demonstrates how the convergence

sp eed is improved when the information from the photon map is included in the

imp ortance sampling scheme At samples pr pixel the standard imp ortance

sampling metho d gaveaMSEvalue that was more than times larger than the

MSE value obtained when the photon map was used

We also examined the eect of N on the quality of the computed images

p

Using N we obtained the results shown in the graph in g b With the

used parameter conguration we found that increasing N beyond did not

p

improve the result

In g see colour plates wehaveshown the computed images corresp ond

ing to and samples pr pixel The top row contains images

computed with standard imp ortance sampling and the b ottom rowcontains

images computed using imp ortance sampling based on the photon map The

images demonstrates how the noise level is reduced when the information from

the photon map is added

Our second test scene was created to test the algorithm in a more realistic

environment The desk is illuminated bytwolight sources One large in the

ceiling and one small light bulb within the lamp shade The lightfromthelight

bulb is scattered diusely through the lamp shade

We created two images of test scene In g we used standard imp ortance

sampling and in g we used the photon map with N and N

p

We also created a reference image using samples pr pixel and the MSE of

g was approximately times larger than the value for g The reduction

in noise is particularly visible at the wall just b ehind the lamp shade

The implementation of the photon map has not b een optimized The compu

tation of the photon contribution to the reected radiance makes heavy use of

trigonometric functions Still the computation time of g was only increased

with due to the use of the photon map The time used by the photon map

was only aected noticeably bychanging N and this is primarily due to the

change in the numberofevaluations of trigonometric functions

We tried to reduce the eect of N on the computation time by replacing the

photon map with hemicub es stored at discrete p ositions within the scene During

imp ortance sampling the nearest hemicub e would represent the incoming ux

We did however nd that this approach suered from aliasing problems and the

results obtained were not very go o d Instead we plan to limit the number of

directions for a photons to p erhaps In this waywewould b e able to use

lo okup tables and completely avoid trigonometric evaluations

Conclusion and Future Directions

In this pap er wehave demonstrated how the use of photon maps in an imp ortance

sampling scheme can improve the quality of images computed using the path

tracing algorithm Based on a rough estimate of the incoming ux we concentrate

our samples in those directions that contributes mostly to the reected radiance

This improves the convergence sp eed without adding bias to the nal solution

By using the photon map wewere able to reduce the noise level in the computed

images with more than compared with traditional imp ortance sampling

approaches without increasing the numb er of sampling rays

Future enhancements include further investigation in the parameters for the

metho d By increasing the numb er of photons used we should b e able to obtain

even b etter results Combining this with a more ecient usage of the information

in the photon map would make the metho d very suitable for the visualization

step in the existing two pass techniques for global illumination

Acknowledgments

The author wishes to thank GK for providing excessive computational resources

and to the reviewers and Eric Lafortune for their helpful comments to the pap er

References

Arvo James and David Kirk Particle Transp ort and Image Synthesis Com

puter Graphics

Arvo James and David Kirk Unbiased Sampling Techniques for Image Syn

thesis

Bentley Jon Louis and Jerome H Friedman Data Structures for Range Search

ing Computing Surveys

Blasi Philipp e Bertrans Le Saec and Christophe Schlick An Imp ortance

Driven MonteCarlo Solution to the Global Illumination Problem Eurographics

Workshop on Rendering Darmstadt

Chen Shenchang Eric Holly E Rushmeier Gavin Miller and Douglas Turner

A Progressive MultiPass Metho d for Global Illuminatio n Computer Graphics

Ka jiya James T The Rendering Equation Computer Graphics

Jensen Henrik Wann and Niels Jrgen Christensen Photon maps in Bidirec

tional Monte Carlo RayTracing of Complex Ob jects Computers and Graphics

no

Lafortune Eric P Yves D Willems Bidirection al Path Tracing Proceedings

of CompuGraphics june

Lafortune Eric P Yves D Willems A D Tree to Reduce the Variance of

Monte Carlo RayTracing Eurographics Workshop on Rendering Dublin

Lange Brigitta The Simulation of RadiantLightTransfer with Sto chastic Ray

Tracing Eurographics Workshop on Rendering Barcelona

Nico demus F E J C Richmond J J Hsia I W Ginsb erg T Limp eris Ge

ometrical Considerations and Nomenclature for Reectance National Bureau

of Standards okt

Rubinstein Reuven Y Simulation af the John Wiley

Sons

Rushmeier Holly Charles Patterson and Aravindan Veerasamy Geometric

Simplic atio n for Indirect Illuminati on Calculations Pro ceedings of Graphics

Interface

ShirleyPeter A RayTracing Metho d for Illuminati on Calculation in Diuse

Sp ecular Scenes Pro c Graphics Interface

ShirleyPeter and ChangyawWang Direct Lighting Calculation byMonte

Carlo integration Eurographics Workshop on Rendering Barcelona

ShirleyPeter Nonuniform Random Point Sets via Warping In Graphics Gems

IIIDavid Kirk ed Academic Press

Sillio n Francois X James R Arvo Stephen H Westin and Donald P Green

b erg A Global Illumination Solution for General Reectance Distributions

Computer Graphics

Veach Eric and Leonidas Guibas Bidirection al Estimators for LightTrans

p ort Eurographics Workshop on Rendering Darmstadt

Ward Gregory J Francis M Rubinstein and Rob ert D Clear A RayTracing

Solution for Diuse Interreection Computer Graphics

Ward Gregory J Adaptive ShadowTesting for RayTracing Eurographics

Workshop on Rendering Barcelona

Ward Greg Real pixels In Graphics Gems I I James Arvo ed Academic

Press

Ward Gregory J and Paul S Heckb ert Irradiance Gradients Eurographics

W orkshop on Rendering Bristol

Ward Gregory J The RADIANCE Lighting Simulation and Rendering Sys

tem Computer Graphics

Fig Test scene sampled using and samples pr pixel The top

rowshows the results using standard imp ortance sampling and the b otton rowshows

the results when the information from the photon map is added

Fig Test scene sampled with samples pr pixel using standard imp ortance

sampling

Fig Test scene sampled with samples pr pixel using imp ortance sampling enhanced with the photon map