<<

BIDIRECTIONAL PATH TRACING

Eric P Lafortune Yves D Willems

Department of Computing Science

KatholiekeUniversiteit Leuven

Celestijnenlaan A Leuven Belgium

EricLafortunecskuleuvenacb e

ABSTRACT

In this pap er we presenta newMonte Carlo rendering algorithm that seamlessly integrates

the ideas of sho oting and gathering p ower to create photorealistic images The algorithm

can b e explained as a generalisation of the wellknown path tracing algorithm Test results

show that it p erforms signicantly b etter for typical indo or scenes where indirect lighting

is imp ortant

Key Words Rendering and visualisation and photorealistic render

ing

INTRODUCTION between diuse emitters and reectors of ra

diative energy such as heat or light It re

Both the eyepoint of the viewer and the set of

quires the scene to b e discretised into patches

primary light sources in a scene havealways

or elements and as such it is a nite ele

b een identied as b eing imp ortant for solv

ment metho d The radiosity solution is view

ing the global illumination problem to cre

indep endent the solution do es not takeinto

ate a realistic rendering Some algorithms

account the eventual viewp oint Smits et al

suchasray tracing are entirely built around

Smits et al intro duced the notion of im

the imp ortance of the viewing p oint Other

p ortance and adapted the radiosity algorithm

algorithms such as the progressive radiosity

to tune the solution towards the nal ren

metho d put a great emphasis on the con

dering Their progressive radiosity algorithm

tributions of the light sources Ideally one

sho ots light from the light sources and imp or

would want an algorithm whichtakes into ac

tance from the viewp oint

count the imp ortance of b oth the light sources

and the viewing p oint In this pap er we will

In Ka jiya Ka jiya presented the render

present a new Monte Carlo algorithm which

ing equation and intro duced path tracing as

treats light sources and the viewing p ointon

a Monte Carlo algorithm to solve it The idea

an equal basis

is to sample the ux through the pixels gath

ering lightby following all light paths backto

RELATED WORK

the light sources As suchitisentirely view

An imp ortant milestone in the development dep endent Various other algorithms are

of the global illumination theory for computer based on the same principle Co ok et al

graphics was the intro duction of the radios Shirley Monte Carlo techniques are ca

ity metho d by Goral et al Goral et al pable of handling the most general class of

Originally develop ed within the eld of heat lighting eects but are generally slow to con

transfer it is based on the energy equilibrium verge light path eye path shadow rays

screen light source

eye point

Figure A schematic representation of the bidirectional path tracing algorithm

Most research on the global illumination a selected light source and from the view

problem is currently directed towards two ing p oint in much the same way All hit

pass metho ds Chen et al These com points on the resp ective particle paths are

pute diuse lighting comp onents in a rst ex then connected using shadowrays and the

tended progressive radiosity pass and sp ec appropriate contributions are added to the

ular lighting comp onents in a second view ux of the pixel in question Fig Us

dep endent pass The diuse comp onents ing this approachvarious lighting contribu

are computed using a deterministic metho d tions are taken into account not only from

Wallace et al Ward et al Sillion primary light sources but in a probabilistic

Puech Lange PattanaikMudur or a way also from imp ortant secondary tertiary

Monte Carlo technique FedaPurgathofer etc light sources

Pattanaik The nal image including the We will now present in greater detail which

sp ecular reections is usually rendered using probability distribution functions pdfs gov

some variant of distribution or ern the random walks and how the eective

path tracing Some algorithms attempt to re contributions to the ux are then calculated

construct not only the diuse comp onent but It can b e proven mathematically that these

also the directional comp onent of the emit lead to a correct solution of the rendering

ted light in order to nd a completely view equation or its adjoint formulation

indep endent solution of the problem Immel

Performing the random walks

et al Sillion et al The main problem

As shown in Fig the random walks can b e

with the latter approach is the huge amount

written as

of storage that is required to represent the

lighting function

x x x x for the light path where

   N

l

x is the p oint seen by p oint x along di

i i

BIDIRECTIONAL PATH TRACING rection and

x

i

y y y y for the eye path where

   N 

e

The algorithm we present diers from dis

y is the p oint that sees p oint y along

j  j

tribution ray tracing or path tracing in its

direction

y

j 

computation of a primary estimator for the

ux through each pixel The basic idea is The initial p oints and directions of the ran

that particles are shot at the same time from dom walks have to b e selected rst Using the x3 x2 y Θ 1 x2 light path Θ y1 eye path Θ x1 x1 Θ y y0 Θ 0 x0

x 0 screen light source

eye point

Figure Naming conventions for x and y to denote the light

 x x  y y

 

N  N 

e

l

path and the eye path resp ectively In this example N equals and N equals

l e

Θ x0 Θ y0 y0

x0 pixel

light source screen

x and according to

Figure Sampling eye point

 x



the selfemitted radiance of light sources

Figure Sampling y and with resp ect

 y



naming conventions ab ovewe do this for the

to the pixel under consideration

eye path by sampling x and according

 x



to the following pdf which is based on the

Similarly we select samples y and for

 y



principle of imp ortance sampling Fig

the eye path according to the following pdf

L x j N j

e x x x

Fig

pdf x

x

L

g y j N j

y y y

pdf y

y

with the normalisation factor of the pdf

G

Z Z

with the normalisation factor of the pdf

L L x j N j d d

Z Z

e x x x x x

A 

x

g y j N j d d G

y y y y y

A 

where L x is the selfemitted radi

y

e x

where g y the function is for all pairs of ance at p oint x in direction and where

y x

points and directions y on the surfaces j N j is the absolute value of the cosine of

y x x

that contribute to the ux and otherwise the angle b etween and the normal vector

x

Once the initial p oints and directions have at x The imp ortance sampling ensures that

b een chosen the rest of the random walks is more light particles are shot from bright emit

determined by sampling the directions ters and in bright directions instead of dis

x

i

and resp ectively These variables deter tributing them uniformly and weighting their

y

j 

mine x and y unambiguously contributions to the ux later on

i j 

Θ Estimating the ux

xi + 1

Now that wehave shown how the sto chastic

x +

ariables for the integrals and for the random

i 1 v

alks are selected we will actually evaluate

Θ w

or this purp ose all p oints on

xi the nal result F

the resp ective random walks are linked using

shadowrays The primary estimator for the

ux can then b e derived as a sum of weighted

Figure Sampling according to the

x

i

partial estimates

brdf of the surface at p oint x and the in

i

N

N

e

l

X X

coming direction

hi w hC i

x

i

ij ij

i j 

The factors hC i express the estimates of the Θ ij

yj + 1

ux found by i reections on the light path

and j reections on the eyepath Three

cases have to b e distinguished when evalu ating them

yj

i jhC i G L y

 e  y 

Θ This term is an estimate for the ux re

yj

ceived from a light source that is directly

seen through the pixel under consideration

Figure Sampling according to the

y

j 

Fig

brdf of the surface at p oint y and the incom

j

i jhC i

ing direction

j

x

j

L G L x

e  x y

 j 

f y

r j  x y y

 j  j 

The subcritical pdf spdf for is chosen

x

i

 N  N

j x y x jj x y y j

  

j  j  j 

as follows again on the basis of imp ortance

v x y

 j 



kx y k

 j 

sampling Fig

L

R

with L

L x   N d

e x j x x j x







x

pdf f x N

r i x x x

i i

where is the direction from p oint x

xy

where f x is the bidirectional re

r in out

to p oint y and where v x y is the visibility

ection distribution function brdf The pdf

function whichisifpoint x sees p oint y

is sub critical b ecause it do es not integrate to

and otherwise This value is found by

over all p ossible angles at least for physi

means of the shadowraybetween p oint x

cally valid brdfs The actual value of the in

and p oint y

tegration gives the chance that the random

The term is an estimate for the ux

walk is continued which ensures that the ran

that reaches the eye from the light source

dom walk terminates This technique is com

through the eye path as in classical path

monly called Russian roulette

tracing Fig

The sub critical pdf for is chosen in

y

j 

the same way Fig

i jhC i

ij

L G f x

N pdf f y

r i x x y

y y r j y

i i j 

j j

f y

r j  x y y

i j  j 

The random walks are indep endent of one

N N  

y j x jj x y j x y

j  i i j  i j 

v x y another The spdfs for the directions can b e

i j 



kx y k

i j 

made identical simply by renaming the vari

This term is an estimate for the ux

ables and using the bidirectional prop ertyof

that reaches the eye from the light source

the brdf This prop erty implies that after the

through i reections on the light path and

initialisation b oth random walks can b e p er

j reections on the eye path Fig

formed by a single algorithm y1

Θ y 〈〉 1 C02

〈〉 y0 Θ C01 x0 Θ y0 x 0 screen light source

eye point

Figure The contribution hC i is an estimate for the ux that reaches the eye from the light

j

source through the eyepath

Θ x3 x x 2 2 〈〉 C32 y1 〈〉C 22 Θ y Θ 1 x1 〈〉C 12 〈〉 C31 〈〉C x1 21 〈〉 y0 C11 Θ x0 Θ y0 x 0 screen light source

eye point

Figure The contribution hC i is an estimate for the ux that reaches the eye through b oth

ij

the light path and the eye path Θ Θ 〈〉 yj + 1 y0 C3, j − 1 y0

〈〉 〈〉C , − C00 2 j 1 − 1 Wj Wj 〈〉 screen C1, j − 1 y eye point j 〈〉C 0, j − 1 Θ

yj

Figure The contribution hC i is an esti



mate for the ux emitted by a light source

Figure The weights W for the contribu

j

that is seen directly by the viewer

tions via the eye path are selected prop or

tional to the degree of sp ecularity at p oint

Selecting the weights

y The contributions arriving from the light

j

path via the shadowrays have the weight

At this p oint the algorithm is still generic as

W

there are various alternatives to cho ose the

j

weights w for the contributions hC ias

ij ij

long as they comply with the condition that

P

N

w N This condi

iN i

of the light path is more likely to b e im

i

tion can b e derived theoretically its physical

p ortant Therefore the weight W is chosen

j

meaning is that the sets of weights for the es

prop ortional to a measure of the degree of

timates of the uxes arriving at the eye via

sp ecularity of the surface at p oint y on the

j

one two etc reections resp ectively all have

eye path For highly sp ecular surfaces it ap

to add up to One can verify that the fol

proaches for diuse surfaces it go es to

lowing instantiation yields the classical path

Tests on practical scenes haveshown that this

tracing algorithm

technique greatly improves the quality of the

images esp ecially when rendering scenes con

w for i and

ij

taining mirrors

otherwise

This selection do es not fully use the infor

mation of the sampling pro cess however The

Computing a secondary estimator

following alternative uses b oth particle paths

more eectively

The primary estimator of the ux will still

j 

Y

have a large variance which will clearly show

w W for i

ij k

up in the image under the form of random

k 

noise As with all Monte Carlo metho ds a

for j and

secondary estimator is therefore computed by

j 

Y

averaging the results of several primary es

W W otherwise

k j

k 

timators for a single pixel The variance of

where the weights W j N still the eventual result will b e reduced by a fac

j e

p

leave some degrees of freedom tor N if N is the numb er of primary sam

The idea b ehind this particular choice is ples For path tracing N rep ortedly typi

that at each p ointontheeye path the es cally ranges b etween and but the op

timates for the indirect lighting via the rest timal numb er largely dep ends on the com

of the eye path and via the light path are plexity of the scene and the desired accuracy

weighted Fig For sp ecular surfaces one Some heuristic adaptive sampling techniques

would rather rely on the estimate found by are usually applied to nd a balance b etween

following the eye path For diuse surfaces the computational work and the quality of the

the estimate found through the contributions results

IMPLEMENTATION ections soft shadows and colour bleeding

The results for the directly illuminated scene

Wehave implemented the bidirectional path

show little dierence b etween them For

tracing algorithm as describ ed ab ove The

the indirectly illuminated scene however our

program has b een written in the program

bidirectional algorithm pro duces visibly less

ming language C on an IBM RS It

noise for the same amountofwork it is even

is based on the library routines of the public

noticeable on the printed images in spite

domain ray tracing program Rayshade

of the dithering applied to pro duce dierent

The brdfshave b een mo deled using a Phong

colour shades An intuitive explanation is

mo del which has b een mo died slightly as to

that the light particle paths help the indirect

make it recipro cal and energyconserving It

light to meet the eye paths halfway thereby

allows the few constants in the equations and

pro ducing more reliable estimates and less

the pdfs to b e computed analytically More

noise

complicated mo dels will in general require nu

merical techniques

CONCLUSION

Several optimised sampling strategies have

b een implemented Imp ortance sampling and

Wehave presented bidirectional path trac

Russian roulette have b een applied as ex

ing as a new Monte Carlo algorithm for

plained in the previous paragraphs Fur

physicallybased rendering It can b e ex

thermore stratied sampling has b een used

plained in a general theoretical framework in

This technique consists in sub dividing the

which the existing path tracing algorithm is

sampling intervals and selecting samples from

a sp ecial case

each of these instead of just selecting all sam

ples randomly over the whole interval The

Similarly to other Monte Carlo techniques

uniform samples selected in this waymay

the algorithm is very general it can handle

b e transformed into nonuniform samples so

extensive classes of geometrical ob jects and

that the technique is combined easily with im

optical prop erties Diuse lighting eects

p ortance sampling

soft shadows sp ecular and glossy reec

tions and refractions and if required even

RESULTS

depth of eld and motion blur are all simu

Based on the implementation we have

lated correctlyAntialiasing is integrated

p erformed some tests comparing our bi

in a natural way

directional path tracing algorithm with classi

cal path tracing The largest amountofwork

Exp eriments show that the algorithm p er

in b oth algorithms consists in p erforming ray

forms b etter than path tracing for typical

intersection tests So in order to obtain a fair

indo or scenes where indirect illumination is

comparison approximately the same numb ers

imp ortant

of rays are used by the resp ective algorithms

in each test Table gives an overview of

The metho d requires no meshing and thus

the results All images have b een rendered

avoids all the asso ciated problems Also

at a resolution of pixels Both

b ecause of this the metho d requires little

implementations use the optimised sampling

memory The description of the scene is

strategies such as imp ortance sampling Rus

accessed in a readonly fashion

sian roulette and stratied sampling Neither

of the algorithms p erforms adaptive sampling Imp ortance sampling is used extensively

of the pixels reducing the variance drastically Without

The scene consists of coloured diuse walls adaptive sampling however convergence is

a slightly sp ecular o or and a mixture of rather slow This is partly b ecause the ex

opaque and transparent ob jects Both algo act solution is sought for each pixel as op

rithms accurately render typical global illu p osed to nite element metho ds where the

mination eects such as diuse and glossy re eventual solution is interp olated over larger

Test Algorithm Numb er of samples Total number Time sec

p er pixel of rays

Path tr

Bidir path tr

Path tr

Bidir path tr

Table Overview of the test results

surface areas most of the time Adap simulation of the particle mo del of light In

tive and hierarchical techniques and lter Proceedings of the ThirdEurographics Work

ing should help to nd a prop er balance shop on Rendering pages Bristol

between oversolving and undersolving in UK

the future

Pattanaik SN Computational Meth

REFERENCES ods for Global Il lumination and Visualisa

tion of Complex D Environments PhD the

Chen SE Rushmeier HE Miller G

sis Birla Institute of Technology Science

Turner D A progressivemultipass

Pilani India

metho d for global illumination In Computer

Graphicsvolume pages

ShirleyP Physical ly Based Lighting Cal

culations for PhD the

Co ok RL Porter T Carp enter L

sis University of Illinois

Distributed ray tracing In Computer Graph

icsvolume pages

Sillion F Arvo JR Westin SH Green

b erg DP A global illumination solu

Feda M Purgathofer W Progres

tion for general reectance distributions In

siveray renement for monte carlo radiosity

Computer Graphicsvolume pages

In Proceedings of the Fourth Eurographics

Workshop on Rendering pages Paris

France

Sillion F Puech C A general twopass

metho d integrating sp ecular and diuse re

Goral CM Torrance KE Greenb erg DP

ection In Computer Graphicsvolume

Battaile B Mo delling the interaction

pages

of lightbetween diuse surfaces In Com

puter Graphicsvolume pages

Smits BE Arvo JR Salesin DH An

imp ortancedriven radiosity algorithm In

Immel DS Cohen MF Greenb erg DP

Computer Graphicsvolume pages

A radiosity metho d for nondiuse

environments In Computer Graphicsvol

ume pages

Wallace JR Cohen MF Greenb erg DP

A twopass solution to the rendering

Ka jiya JT The In

equation a synthesis of ray tracing and ra

Computer Graphicsvolume pages

diosity metho ds In Computer Graphicsvol

ume pages

Lange B The simulation of radiant light

Ward GJ Rubinstein FM Clear RD

transfer with sto chastic raytracing In Pro

Aray tracing solution for diuse in

ceedings of the Second Eurographics Work

terreection In Computer Graphicsvol

shop on Rendering Barcelona Spain

ume pages

Pattanaik SN Mudur SP Compu

tation of global illumination bymonte carlo