the computation of higher-order radiosity approximations ... · the computation of higher-order...

10
The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert Mateu Sbert Yves D. Willems K. U. Leuven – Department of Computer Science (Leuven, Belgium) Universitat de Girona – Departament d’Inform` atica i Matem` atica Aplicada (Girona, Spain) Abstract The computation of higher-order polynomial radiosity ap- proximations on a fixed element mesh, results in more smooth images than with a traditional piecewise constant radiosity approximation. Unfortunately, the number of form factors to be stored in a deterministic approach is considerably higher than with a constant approximation and the computation itself of the form factors is more dif- ficult. In this paper, we present a new stochastic approach for computing higher-order radiosity approximations. The new approach is based on stochastic Jacobi iterations pre- viously used in stochastic ray radiosity and the well- distributed ray set radiosity algorithm. Like in these previ- ous algorithms, explicit computation and storage of form factors is completely avoided. The storage and computa- tion cost of the new algorithm are analysed and several variance reduction techniques are described. In spite of the fact that the new algorithm does not avoid radiosity kernel discretisation, its results are at least as good as with a continuous random walk approach. Keywords: Radiosity, Monte Carlo method, Stochastic Jacobi iterative method 1 Introduction The radiosity method, first introduced in computer graph- ics in [11, 20], is a physically based method to compute the illumination in a virtual environment consisting of sur- faces that exhibit only diffuse (Lambertian) light emis- sion and reflection. The traditional radiosity method con- siders polygonal environments, subdivided in patches i. For each patch, the average radiosity B i (light power per unit of area) is computed by solving a set of linear equa- tions [11, 7]: B i E i ρ i j F ij B j (1) In these equations, E i denotes the average spontaneously emitted radiosity (nonzero only for light sources), ρ i is the reflectivity (a dimensionless number between 0 and 1) and F ij is the form factor which indicates to what extent the radiosity emitted by j contributes to the incident radiosity at i. The traditional radiosity method suffers from several problems that severely limit its practical use on real-world 3D models. These problems are mainly related with two aspects of the method: the discretisation of a scene into planar patches on which a single, average, radiosity value is computed and the computation and storage of the form factors F ij between each pair of patches i and j: discretisation: the resulting patches shall be small enough so that the light intensity over each patch is to good approximation constant. If they are not small enough, image artifacts such as discontinuit- ies at patch boundaries and shadow- and light leaks become visible in the computed images. These dis- continuities are washed out when Gouraud interpola- tion is employed, but this does not necessary result in more accurate images (see figure 1, left column); form factor computation and storage: except for very simple environments, the number of form factors is huge. There is a non-zero form factor for every pair of patches that are at least partly mutually visible. Moreover, for each form factor, a non-trivial four- dimensional integral with potentially discontinuous and singular integrand needs to be computed. Accur- ate numerical solution of these integrals is difficult. Much research has focussed on the solution of these prob- lems. Proposed techniques include higher-order radios- ity approximations, discontinuity meshing, numerous spe- cific form factor integration techniques and accelerations, sub-structuring, adaptive meshing, multi-level hierarch- ical techniques, clustering, the use of view-importance and clever form factors caching strategies [8, 29]. This paper will focus on higher-order radiosity approx- imations, proposed first in [12, 34, 32]. Let Bx denote the “true” radiosity as a function of spatial location x on the surfaces of objects in the scene. Instead of comput- ing only a single constant radiosity approximation B i for Bx , the idea is now to compute the coefficients B i α in a

Upload: others

Post on 15-Sep-2019

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

The Computation of Higher-Order RadiosityApproximations with a Stochastic Jacobi Iterative Method

PhilippeBekaert�

MateuSbert�

YvesD. Willems�

�K. U. Leuven– Departmentof ComputerScience(Leuven,Belgium)�

UniversitatdeGirona– Departamentd’Informaticai MatematicaAplicada(Girona,Spain)

Abstract

Thecomputationof higher-orderpolynomialradiosityap-proximationson a fixed elementmesh, resultsin moresmoothimagesthanwith a traditionalpiecewiseconstantradiosity approximation. Unfortunately, the numberofform factorsto be storedin a deterministicapproachisconsiderablyhigher than with a constantapproximationandthecomputationitself of theform factorsis moredif-ficult.

In this paper, we presenta new stochasticapproachfor computinghigher-orderradiosityapproximations.Thenew approachis basedon stochasticJacobiiterationspre-viously used in stochasticray radiosity and the well-distributedraysetradiosityalgorithm.Likein theseprevi-ousalgorithms,explicit computationandstorageof formfactorsis completelyavoided. Thestorageandcomputa-tion cost of the new algorithm are analysedand severalvariancereductiontechniquesare described. In spite ofthe fact that the new algorithm doesnot avoid radiositykerneldiscretisation,its resultsareat leastasgoodaswitha continuousrandomwalk approach.

Keywords: Radiosity, Monte Carlo method,StochasticJacobiiterativemethod

1 Introduction

Theradiositymethod,first introducedin computergraph-ics in [11, 20], is a physicallybasedmethodto computetheilluminationin avirtual environmentconsistingof sur-facesthat exhibit only diffuse (Lambertian)light emis-sionandreflection.Thetraditionalradiositymethodcon-siderspolygonalenvironments,subdivided in patchesi.For eachpatch,the averageradiosityBi (light power perunit of area)is computedby solving a setof linearequa-tions[11, 7]:

Bi� Ei

� ρi ∑j

Fi jB j � (1)

In theseequations,Ei denotesthe averagespontaneouslyemittedradiosity(nonzeroonly for light sources),ρi is the

reflectivity (adimensionlessnumberbetween0 and1) andFi j is the form factorwhich indicatesto what extent theradiosityemittedby j contributesto theincidentradiosityat i.

The traditional radiosity methodsuffers from severalproblemsthatseverelylimit its practicaluseonreal-world3D models. Theseproblemsaremainly relatedwith twoaspectsof the method: the discretisationof a sceneintoplanarpatcheson which a single,average,radiosityvalueis computedandthecomputationandstorageof theformfactorsFi j betweeneachpair of patchesi and j:

� discretisation: the resulting patchesshall be smallenoughso that the light intensity over eachpatchis to good approximationconstant. If they are notsmall enough,imageartifactssuchas discontinuit-ies at patchboundariesandshadow- andlight leaksbecomevisible in the computedimages.Thesedis-continuitiesarewashedoutwhenGouraudinterpola-tion is employed,but thisdoesnotnecessaryresultinmoreaccurateimages(seefigure1, left column);

� form factorcomputationandstorage:exceptfor verysimpleenvironments,the numberof form factorsishuge. Thereis a non-zeroform factorfor every pairof patchesthat are at leastpartly mutually visible.Moreover, for eachform factor, a non-trivial four-dimensionalintegral with potentially discontinuousandsingularintegrandneedsto becomputed.Accur-atenumericalsolutionof theseintegralsis difficult.

Much researchhasfocussedon thesolutionof theseprob-lems. Proposedtechniquesinclude higher-order radios-ity approximations,discontinuitymeshing,numerousspe-cific form factorintegrationtechniquesandaccelerations,sub-structuring,adaptive meshing,multi-level hierarch-ical techniques,clustering,theuseof view-importanceandclever form factorscachingstrategies[8, 29].

This paperwill focuson higher-orderradiosityapprox-imations,proposedfirst in [12, 34, 32]. Let B � x� denotethe “true” radiosityasa function of spatiallocationx onthe surfacesof objectsin the scene. Insteadof comput-ing only a singleconstantradiosityapproximationBi forB � x� , theideais now to computethecoefficientsBi � α in a

Page 2: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

� ��� ������������� ����� ���� !������� "�#$ ���� % $ ����� ��� #�����&'�� " #�����" � �(� � ��� ���� )������� " #

Flat shaded Gouraud shaded

Figure 1: Meshingartifactsin radiosity with constantapproximations(left) include undesiredshadingdiscontinuitiesalongpatchedges.Gouraudshadingcanbe usedto blur thesediscontinuities.Unlike Gouraudshading,a higherorderapproximationof radiosityon eachpatchresultsin a moreaccurateimageon thesamemesh(a quadraticapproximationwasusedin theright column).Themiddlecolumnshowsthe“true” radiositysolution(with bidirectionalpathtracing).

non-constantpolynomialapproximation

B � x� � ∑α

Bi � αψi � α � x��* B � x� (2)

for B � x� on eachpatchi. The ψi � α � x� in this sumareso-calledbasis,or shape,functions. Many choicesarepos-siblefor thebasisfunctions.A convenientchoiceis to useorthonormal“canonical”basisfunctionsontheunit squareor standardtriangle, that are uniformly mappedto con-vex quadrilateralor triangularthree-dimensionalpatches[5, 1]. The algorithmsproposedin this paperarenot re-strictedto this choicehowever.

Figure 1 (right column) shows that the useof higher-order radiosity approximationsindeed allows to obtainmore accurateradiosity approximationsin a fixed meshthana constantapproximation.However, it will beshownbelow ( + 3) that higher-orderapproximationsalso leadtoa significantincreaseof the numberof generalisedformfactorsthatneedsto becomputedandstorage.Moreover,thecomputationof theseform factorsis alsomoredifficultbecausethe integrandnow includeshigher-orderpolyno-mial factorsthatarenotpresentwith aconstantapproxim-ation.

On the other hand, in previous work on Monte Carloradiosity [28, 21, 10, 24, 16, 18, 27, 17], efficient al-gorithmshave beendevelopedin which theradiositysys-tem of equations(1) is solved efficiently without explicitform factorcomputationandstorage.This is possiblebe-causethe form factorsFi j for fixed patch i form a prob-ability distribution that canbe sampledefficiently by tra-cing raysthroughthescene.It turnsout thatby usingtheform factorsasasamplingprobabilitydistribution,thenu-mericalvalueof theform factorsis neverrequiredandtheform factorsalsodo not needto bestored.This resultsinenormoussavings in storagerequirements.Moreover, theemployed Monte Carlo algorithmsalso have lower time

complexity: only , � nlogn� insteadof , � n2 � , assuming, � logn� complexity of tracinga ray with n thenumberofpatches.MonteCarloradiosityalgorithmsalsoallow bet-ter control of the computationalerror than deterministicapproaches.They are easierto implementcorrectlyandmoreuser-friendly to useaswell [1].

In orderto overcomegeneralisedform factorcomputa-tion andstorageproblems,previous Monte Carlo radios-ity algorithmsfor constantapproximationscanbe exten-ded. Suchan extensionhasbeenproposedby FedaandBouatouchet al. [9, 6] for so calledcontinuousrandomwalk algorithms(explainedbelow). This paperpresentstheextensionof thestochasticJacobiiterative methodfordealingwith higher-orderradiosity. ThestochasticJacobiiterative methodwasproposedfor constantradiosityap-proximationsby Neumannetal. [16, 18, 17] in algorithmscalled“stochasticray radiosity” and“well-distributedraysetradiosity”. The extensionof otherstochasticiterativemethodsfor radiosity [28, 10] can be donein a similarway.

2 Mathematical problem formu-lation

First,abrief review is presentedof theequationsthatneedto besolvedfor higher-orderradiositycomputations.Theremainderof this paperbasicallydealswith the efficientsolutionof theseequations.

2.1 The radiosity integral equation

The“true” radiosityB � x� in a diffusesceneis thesolutionof anintegralequation

B � x� � E � x� � ρ � x�-

SG � x . y� B � y� dAy (3)

Page 3: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

with kernel:

G � x . y� � cosθx cosθy

πr2xy

vis � x . y� � (4)

where� x andy denotepointson thesurfacesSof theobjects

in thescene;

� E � x� is the spontaneouslyemittedradiosityat x andρ � x� is thereflectivity;

� Sdenotesthesurfacesof theobjectsin thescene.dAy

is theareaof adifferentialsurfaceat thepoint y / S;

� cosθx andcosθy arethecosineof theanglebetweentheline connectingthepointsx andy andthesurfacenormalsatx andy respectively;

� rxy is thedistancebetweenthepointsx andy;

� vis � x . y� is apredicatethattakesthevalue1 if x andyaremutuallyvisibleand0 otherwise.

Equation(3) is a simplified instanceof the moregeneralrenderingequationintroducedin graphicsby Kajiya [13].

The problemnow consistsin determiningcoefficientsBi � α in equation(2) thatwill leadto a“best” approximationof thetrueradiosityfunctionB � x� for a givensetof basisfunctionsψi � α onafixedsetof patchesi. Two strategiestosolve this problemwill bepresentednow: a “continuous”strategy in whichequation(3) is notdiscretised( + 2.2)anda “discrete”strategy in which it is ( + 2.3).

2.2 Continuous Solution Strategy

A first, direct,way in orderto obtainthecoefficientsBi � αis by “projectingB � x� ontothefunctionspacespannedbythe basisfunctionsψi � α � x� ”. The coefficientsBi � α canbecomputedasscalarfunction productswith the dual basisfunctionψi � α � x� :

Bi � α � -SB � x� ψi � α � x� dAx � (5)

Thedualbasisfunctionsψi � α � x� aretheuniquesetof linearcombinationsof the primary basisfunctionsψi � α � x� thatsatisfythefollowing orthonormalityproperty:-

Sψi � α � x� ψ j � β � x� dAx

� δi jδα � β �δi j andδαβ areKroneckersdeltafunctions.In [5, 1] acon-venientsetof basisfunctionsψi � α is proposed.For thesebasisfunctionsψi � α � x� � ψi � α � x�10 Ai : thedualbasisfunc-tionsarethesameastheprimarybasisfunctions,dividedby thesurfaceareaof thepatchi.

At first sight, equation(5) doesnot seemvery usefulbecausethe solutionB � x� is of coursenot known. It willbeshown thatwecanrandomlysamplepointsxdistributedwith densityproportionalto B � x� so that it canbe solvedusinga MonteCarloapproach( + 3.1).

2.3 Discrete Solution Strategy

Alternatively, a Galerkin-typeprojectionmethod[12, 34]canbe employed in order to reduce(3) to the followingsystemof linearequations:

Bi � α � Ei � α � ∑j � β Ki � α; j � βB j � β (6)

with generalisedpatch-to-patchform factors

Ki � α; j � β � -Si

ψi � α � x� ρ � x�-

Sj

G � x . y� ψ j � β � y� dAydAx � (7)

In theseequations,Si and Sj denotethe surfaceof thepatchesi and j. Ei � α arethecoefficientsof the“best” ap-proximationE � x� � ∑i � α Ei � αψi � α � x� of thespontaneouslyemittedradiosityE � x� by alinearcombinationof thebasisfunctions.

It canbeshown veryeasilythatthetraditionalradiosityequation(1) for constantapproximationscorrespondstothe casewith only one basisfunction ψi � x� per patch i,which takesthevalue1 if x / Si and0 if x doesnot lay onthepatchi. In thatcase,ψi � x� � 1 0 Ai for pointsx on i and0 outsidei, andKi j

� ρiFi j .If thereareM basisfunctionson eachpatch,thereare

M2 generalisedform factorsper pair of patches. For aquadraticapproximationwith 6 basisfunctionsper patchfor instance, the number of form factors is 36 timeshigherthanfor a constantapproximation.Moreover, theform factor integrandin (7) containsadditionalpolyno-mial factorsψi � α � x� ψ j � β � y� so that an integration rule ofhigherprecisionwill berequiredin orderto computethemaccurately.

2.4 Continuous versus discrete

The coefficients Bi � α in the continuousand the discreteapproachesare not the same: thesemethodscomputeaslightly differentsolution.Thedifferenceis howeververysmall. It correspondswith thepropagateddiscretisationer-ror, responsiblefor instancefor diffusereflectionsof lightleaksin improperlymeshedscenes[2, 1].

3 Previous work

Themostrelevantpreviouswork concernsthesolutionbyrandomwalksof equation(5) ( + 3.1)andthestochasticJac-obi iterative methodfor linearsystems,proposedby Neu-mannet al. for constantradiosityapproximations( + 3.2).

3.1 Continuous random walk computa-tion of higher-order radiosity ap-proximations

Feda[9] andBouatouchetal. [6] haveproposedarandomwalk algorithmto solve theequations(5). Randomwalksareusedto samplepointsxs� t on thesurfacesof thescene

Page 4: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

thataredistributedwith adensityproportionalto B � x� . In-deed,considera randomwalk tracedasfollows:

1. Select a starting point for an imaginary particleneara point x with probability densityS� x� propor-tional to thespontaneouslyemittedradiosity:S� x� �E � x�10 ΦT . ΦT

�32SE � x� dAx is the total self-emitted

power in thescene;

2. Let theparticlebouncethroughthesceneuntil it getsabsorbed.Thetransitionandabsorptionrulesare:

(a) For a particle at point x, choosea new po-sition y to be visited next with a probabilitydensity G � x . y� . It can be shown easily thatG � x . y� for fixed x is a probability distributionindeed: it is always positive, and the integralover all y equals1. In orderto sampleaccord-ing to G � x . y� , a cosinedistributeddirectionΘx

is chosenw.r.t. thesurfacenormalatx. A ray istracedfrom x into thedirectionΘx. Thenearestintersectionpoint of this ray with the surfacesin thesceneis thepoint y: y � h � x . Θx � .

(b) Theparticleis absorbedat pointy with probab-ility 1 4 ρ � y� . It surviveswith probabilityequalto thereflectivity ρ � y� . Thecompletetransitiondensity from an arbitrary point x to y thus isT � x 5 y� � G � x . y� ρ � y� .

The (unnormalised)densityP � x� of visits of sucha ran-domwalk at a point x simply is thesumof theprobabilityS� x� that a randomwalk is startednearx andthe density2

SP � y� T � y 5 x� dAy that x is visited following a visit toanotherpoint y. In this case(comparewith (3)):

P � x� � E � x�ΦT

� -SP � y� G � y. x� ρ � x� dAy

� B � x�ΦT

�The coefficientsBi � α in (5) can thusbe estimatedby theaveragevalueof thedualbasisfunction ψi � α at thepointsxs� t visitedby therandomwalks:

Bi � α * 1N

N

∑s6 1

τs

∑t 6 0

B � xs� t � ψi � α � xs� t �P � xs� t �

� ΦT

N

N

∑s6 1

τs

∑t 6 0

ψi � α � xs� t � �N is the numberof randomwalks that are traced. τs

denotesthe length of the s-th tracedrandomwalk, withs � 1 . �1�7� . N. xs� t is thet-th point visitedby thes-th tracedrandomwalk, with t � 0 . �7�1� . τs.

The algorithmsby Pattanaik[21], Feda[9] and Bou-atouchet al. [6] slightly differ from the above in that ascoreis recordedat absorptionbut not at theorigin of thepaths. The scoresalso containthe reflectivity ρ � xs� t � inorderto compensateandonly non-selfemittedradiosityisestimated.

Pattanaiksrandomwalk algorithmfor constantradiosity[21] is obtainedwhenchoosinga constantbasis: in thiscase,thereis only 1 dualbasisfunctionψi perpatch.This

dual basisfunction takes the value 10 Ai if x / Si and 0otherwise:ψi � x� � χi � x�80 Ai .

Feda[9] observedthattherequirednumberN of randomwalksin orderto computeasolutionof fixedaccuracy, us-ing aK-th orderproductLegendrebasisontheunit square,is , � K2 � . Only an intuitive argumentwasgiven in orderto explain this observation.

3.2 Stochastic Jacobi iterations forconstant approximations

Neumannet al. [16, 18, 17] proposeda stochasticvariantof thewell-knownJacobiiterativemethodin orderto solvea slightly adaptedversionof (1) for constantradiosityap-proximations:

Pi� Φi

� ∑j

PjFj iρi � (8)

Pi� AiBi andΦi

� AiEi denotethe total andself-emittedpower respectively ata patchi.

In thetraditionalJacobiiterativemethod,a sequenceof

approximatesolutionsP 9 k:i , k � 0 . 1 . �1�7� is constructedbyiteratingtheformulaabove:

P 9 k:i 5 P 9 k; 1:i

� Φi� ∑

j

P 9 k:j Fj iρi � (9)

The self-emittedpower canbe usedasan initial approx-

imation: P 9 0:i� Φi . For n patches,eachiteration takes

, � n2 � operations.Thenumberof iterationsbeforeanac-ceptablesolutionis obtainedis generallynotsolargein ra-diosity: therelativeerrorafterk iterationsis roughlyequalto ρk

av 0�� 1 4 ρav � , with ρav theaveragereflectivity in thescene.

Thebasicideaof thestochasticJacobiiterative methodaccordingto Neumannet al. is to estimatethesumsin theright handsideof (9) by MonteCarlo.Thiscanbedoneasfollows:

1. Selecta patch j with probability p j proportionalto

P 9 k:j : p j� P 9 k:j 0 P 9 k:T , whereP 9 k:T

� ∑ j P 9 k:j denotesthetotal power in thek-th approximatesolution;

2. Next selecta patchl with probability p j l� Fj l . The

form-factorsFj l for a fixed j form a probability dis-tributionindeed:they areall positiveor zeroandtheirsum equals1 in a closedenvironment. This formfactordistribution canbe sampledby uniformly se-lecting a point x on patch j and choosinga cosinedistributed direction Θx. The patchcontainingthenearestintersectionof the ray from x into directionΘx with thesurfacesin thesceneis takenaspatchl ;

3. Contributescores

P 9 k; 1:i

� P 9 k:j Fj l ρl δl i

p j p j l

� P 9 k :T ρl δl i � (10)

Page 5: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

The scoresarenonzeroonly for the patchl that is hit bythe ray. Theform factorFj l cancelsin numeratorandde-nominatorsincep j l

� Fj l sothat its numericalvaluedoesnotneedto beknown. Of course,for N samples,thescoresabove shallbedividedby N. It canbeshown by straight-

forward calculation that the expectationis E < P 9 k; 1:i = �

P 9 k; 1:i 4 Φi . By analysingthe relationbetweenthe vari-

anceof the involved estimators[1] and the numberofpatchesn in the scene,several scenarios[26] lead to a, � nlogn� timecomplexity.

Thesamplingproceduredescribedaboveusessocalledlocal lines, in which the origin of the lines is chosenex-plicitly. Also global lines [24, 16, 31] canbeused.Withglobal lines, the probability of obtaininga sampleon agivenpatch j is proportionalto thesurfaceareaA j of thepatch:p j

� A j 0 AT , with AT thetotal surfaceare.

4 Stochastic Jacobi iterationsfor higher-order approxima-tions

Unfortunately, the stochasticJacobi iterative methodasexplainedabove is not directly applicableto the Galer-kin radiosityequations(6) becausethe generalisedformfactors(7) do not form aprobabilitydistribution: they canbenegativeandtheir sumfor fixed i andα doesnot equal1. It is however possibleto generalisethe methodof theprevioussectionto higherorderradiosityapproximationsby rewriting (6) and(7) in the form of integrals that aresuitedfor a similar samplingscheme.

4.1 Outline of the algorithm

Thesystemof linearequations(6) canalsobesolvedusingthewell-known Jacobiiterativemethod.Whendoingso,a

converging sequenceof approximationsB 9 k:i � α , k � 0 . 1 . �1�7�for thetruecoefficientsBi � α in (2) is constructedby itera-tions

B 9 k:i � α 4>5 B 9 k; 1:i � α � Ei � α � ∑

j � β Ki � α; j � βB 9 k :j � β � (11)

As a startingguessB 9 0:i � α � Ei � α canbe used. Taking intoaccount(7) and(2), theiterationformulaabovecanbere-writtenasthefollowing integralexpression:

B 9 k; 1:i � α 4 Ei � α � -

S

-S

ψi � α � x� ρ � x� G � x . y� B 9 k: � y� dAy dAx �(12)

This sufficesin orderto definea gatheringstochasticJac-obi iterative algorithm. However, by switchingthe integ-rals,

B 9 k; 1:i � α 4 Ei � α � -

SB 9 k: � y�

-SG � y. x� ρ � x� ψi � α � x� dAx dAy

(13)

it becomesevident how the “input” radiositydistributionB 9 k: � y� canbetakeninto accountduringsampling.Equa-tion (13) leadsto estimationproceduresof the followingkind:

1. Selecta point y with normalisedprobability densityp � y� . Two specialchoicesfor p � y� will bediscussedbelow;

2. Selecta point x conditional on y with conditionalprobability p � x ? y� � G � y. x� . As explainedbefore,xcanbesampledby choosinga cosine-distributeddir-ectionΘ w.r.t. thenormalon thesurfaceaty, andde-terminingthefirst intersectionpoint h � y. Θ � � x withthesurfacesin thescene;

3. Contributescores

B 9 k; 1:i � α � y. x� � B 9 k: � y�

p � y� ρ � x� ψi � α � x� � (14)

A non-zerocontribution resultsonly for thosebasisfunctionsfor which thedualψi � α � x� is not zeroat thehit point. Again, if N rays are usedto sampletheintegral, thescoresshallbedividedby N.

Thereis onesuchestimatorfor eachpatchi andbasisfunc-tion α. Becausethedifferenceis only in thescores,theseestimatorscan be sampledsimultaneously. The expect-

ationE < B 9 k; 1:i � α = � B 9 k; 1:

i � α 4 Ei � α. We will now discusstwochoicesfor theprobabilitiesp � y� , correspondingto theuseof localandgloballines.

4.1.1 Local lines

The ray origins y canbe sampledmoredenselyin brightregions:

p � y� � B 9 k: � y�2SB 9 k: � y� dAy

� B 9 k: � y�P 9 k :T

Thescores(14)become

B 9 k ; 1:i � α � y. x� � P 9 k:T ρ � x� ψi � α � x� (15)

Samplingy proportionalto B 9 k: � y� canbedoneasfollows:

1. Chooseapatch j thatshallcontainy with probability

p j� P 9 k :j 0 P 9 k:T ;

2. Choosey / Sj by samplingaccordingto apdf

p j � y� � B 9 k: � y�P 9 k:j

The last step can be performedefficiently using rejec-tion sampling [14], with the maximum radiosity value

B 9 k:j� maxy @ Sj B 9 k: � y� asa referencevalue. Therejection

testdoesnot involve ray tracingandis very cheap. The

Page 6: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

numberof rejectionsis generallylow aswell becausetheradiosityfunctionB 9 k: � y� doesin generalnot vary excess-ivelyonasinglepatch.Thereis aslightadditionalcostdueto theneedto determinethemaximumradiosityvalueonthe patch. In our implementation,we have simply takenthe maximumon a 5 A 5 regular grid. The basisfunc-tionsusedin our implementationreachtheir maximumorminimum valueon thesegrid points. The found valueisof courseonly approximate,but appearsto work well inpractice.

It is instructive to seewhat (15) yields in the constantradiosity approximationcase. In the constantradiosity

case,B 9 k: � y� � B 9 k:j , ψi � x� � χi � x�80 Ai andρ � x� � ρi . x / Si .χi � x� is definedto takethevalue1 if x / Si and0 otherwise.Oneobtainsasbefore(comparewith (10)):

B 9 k; 1:i

� 1Ai

P 9 k:T ρiχi � x� �

4.1.2 Global lines

Theintersectionpointsof globallineswith thesurfacesinthescenehave normaliseddensityp � y� � 10 AT [25]. Thecorrespondingscores(14)are

B 9 k; 1:i � α � y. x� � AT B 9 k: � y� ρ � x� ψi � α � x� �

4.2 Storage and computation cost as afunction of the approximation order

Likein previousMonteCarloradiosityalgorithms,thenu-mericalvalueof the generalisedform factorsis never re-quired in the algorithmsketchedabove. Therefore,theyalso do not need to be storedand numericalproblemswith their accuratecomputationareavoided. For a quad-ratic approximationorderwith 6 basisfunctionsperpatchfor instance,this resultsin a saving of 36 floating pointnumberspernon-occludedpair of patchescomparedwitha deterministicapproach. The storagerequirementsareslightly higher thoughthan in Monte Carlo radiosity al-gorithmsfor a constantapproximationsbecausemultipleradiositycoefficientsBi � α needto bestoredfor eachpatchi insteadof just one. This is true for all higher-orderra-diosity algorithms.It is a low price to bepaid for a moredetailedradiosityrepresentationin thescene.

The computationof a higher order approximationtogiven accuracy is however more costly than for a con-stantapproximation.It canbe shown that the amountofsamplesN neededin orderto computea higherorderap-proximationto fixedstatisticalaccuracy is approximatelyproportionalto the numberof basisfunctionsM on eachpatch.Proof: A sketch of the proof goesas follows: first, it

can be shown that the varianceof the estimatorsB 9 k; 1:i � α

is approximatelyequal for eachα. Next, the variance

of the resultingradiosity estimator∑α B 9 k ; 1:i � α ψi � α � x� can

beobtainedby composingthevariancesof theestimators

B 9 k; 1:i � α . It turnsout that the result is approximatelyequal

to M timesthe varianceof the estimatorfor the constantapproximation. B

4.3 Variance-reduction techniques

In this section,we suggesthow threevariancereductiontechniquescan be applied to the computationof higherorder radiosity approximationsby stochasticJacobi it-erations: view-importancesampling, the use of a con-stantcontrolvariateandthecombinationof gatheringandshooting.With thesetechniques,fewer rayswill suffice inorderto computetheradiosityto givenstatisticalaccuracy.

4.3.1 View-importance sampling

View importance[30, 22] is a quantity that indicatesforeachpatchor point in thescenewhat fractionof its emit-ted light contributesto an image. It canbe usedin orderto concentratecomputationaleffort on thepartsof a com-plex scenethat aremore importantfor a given view. Inimportance-drivenstochasticray radiosity[15, 23], it hasbeenusedto modulatethe probability of shootinga rayfrom a patchin sucha way that moreraysareshotfromimportantpatchesandfewer from unimportantpatches.

View-importancecanbe usedalsoherein order to in-creaseor decreasethenumberof raysto shootfrom eachpatch,basedon its estimatedimportancefor a particularview. It is sufficient to computethe averageimportanceper patch,so that the computationof importancecanbedonein exactly the samefashionasfor the constantcase[15, 1]. Importanceis thenusedto bias p � y� . Thescoresarestill givenby (14).

4.3.2 Constant control variate

A secondway to increasethe efficiency of Monte Carloradiosityalgorithmsis to computethedifferenceB � x�C4 βw.r.t. a well-chosenconstantradiosityβ [19, 1]. Indeed,theiterationformula(13)canalsobewrittenasfollows:

B 9 k; 1:i � α 4 Ei � α� -

S� B 9 k: � y�C4 β � β �

-SG � y. x� ρiψi � α � x� dAx dAy

� -S� B 9 k: � y�C4 β �

-SG � y. x� ρiψi � α � x� dAx dAy

� βρi D-

Sψi � α � x�

-SG � x . y� dAy dAx

(16)

Thelatterintegral is-

Sψi � α � x�

-SG � x . y� dAy dAx

� -S

ψi � α � x� dAx �For anorthogonalbasisobtainedby uniformmappingof acanonicalorthonormalbasis[5, 1],

-S

ψi � α � x� dAx � � 1Ai

-S

ψi � α � x� dAx� δα � 0 �

Page 7: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

Thereis only a constantcontributionρiβ.Theformerintegralcanbeestimatedasoutlinedabove,

choosingp � y� ∝ ? B 9 k: � y�E4 β ? if local lines are used. Agoodvaluefor theconstantcontrol radiosityβ canbeob-tainedby minimising(proof in [1]):

F � β � � ∑s

As ? Bs 4 β ? �In order to minimise F � β � in an actual implementation,we suggesta slightly modified version of the bisectionmethod,in which eachinterval known to containthemin-imum is subdivided in 10 subintervals insteadof just 2.Thecomputationof F � β � requiresa sweepthroughall thepatchesin thesceneandis relatively expensive. It is how-evernotmuchmoreexpensiveto computeF � β � for 11val-uesin a singlesweepthanfor just 3 values.As an initialinterval, the interval < 0 . Bmax= canbe used. Bmax is themaximumaverageradiosityof a patchin thescene.

4.3.3 Using lines bidirectionally

Theprocedureoutlinedabovein + 4.1is ashootingproced-ure: eachray shotfrom a point y on a patch j to a pointx on a patchi is usedto obtaina contribution only at itsend-pointx:

B 9 k ; 1:i � α � y 5 x� � B 9 k: � y� G � y. x� ρ � x� ψi � α � x�

p � y� G � y. x�In a very similar way, a “gathering”estimatorcanbe de-velopedbasedon (12) insteadof (13). For a ray, tracedin an identicalfashionasbeforefrom a point y / Sj to apoint x / Si , the following scoresare contributed to thestart-pointy:

B 9 k; 1:j � β � y F x� � ψ j � β � y� ρ � y� G � y. x� B 9 k: � x�

p � y� G � y. x� �Gatheringcorrespondsto shootingover reversedrays,sothat the shootingandgatheringestimatorscanbe viewedasalternative importancesamplingestimators(a detailedderivationcanbefoundin [1] again).Themultipleimport-ancesamplingframework [33] canthereforebeappliedtorobustly combinethe gatheringandthe shootingestimat-ors. With the balanceheuristic,both the gatheringandshootingscoresof eachray shallbeweightedby:

w � y. x� � p � y� G � y. x�p � y� G � y. x� � p � x� G � x . y� �

p � y�p � y� � p � x� �

Theweightis largeif theprobabilitythattheraywouldbesampledin reversedirectionis smallandviceversa:if theprobability that thereverseray would besampledis high,thescoresreceivea smallweight.

In this way, eachray will result in a contribution toevery basisfunction at both its end-points. Note that inthe constantapproximationcase,p � y� � B j 0 PT , so thattheweightsaresimply proportionalto theradiosityof the

patchwhere the ray originates: w � y. x� � B j 0�� B j�

Bi � .For global lines [24], p � y� � 1 0 AT and the weightsarew � y. x� � 1 0 2. In other words: eachglobal line spanis usedbidirectionally with sameweight for both direc-tions. This confirmstheobservationsmadeby Sbertet al.[24, 27, 25].

5 Results and discussion

Thebasicalgorithmandthevariancereductiontechniqueshave beenimplementedin thecontext of RenderPark [4],our testbedsystemfor globalillumination algorithms.

Figure2 (right column)showsimagesof asimplescenefor a constant,linear, quadraticandcubic approximationorder using the basisfunctionsdescribedin [5, 1]. Theimageswere obtainedwith the basicalgorithm sketchedin + 4.1. They show the resultsafter M units of work,whereM is the numberof basisfunctionsin the approx-imation. The experimentindicatesthat the algorithmde-scribedin this paperindeedis usefulin orderto computehigher-orderradiosityapproximations.The statisticaler-ror in theseimagesis approximatelyequal,confirmingouranalysisof the computationalcostversusthe approxima-tion order( + 4.2).Oneunit of work correspondsto thetimeneededto computethe constantapproximation(about6secondsona195MHzSGIOctaneworkstationwith MIPSR10000processors).

In theleft columnof figure2, theresultsobtainedwithan equalnumberof rays in the continuousrandomwalkradiosity algorithmsfor higher order approximationsbyFedaandBouatouchet al. [9, 6] areshown. By analysingthe varianceof thesecontinuousrandomwalk estimatorsandmaking similar approximationsas for the stochasticJacobiiterative method,it canbe shown that the compu-tationcostof thecontinuousrandomwalk methodis alsoapproximatelyequalto thenumberof basisfunctions[1].Thisconfirmstheobservationsmadeby Feda:aK-th orderproductLegendrebasison theunit squareyieldsK2 basisfunctions,sothatthecostis indeedproportionalto K2 [9].Theapproximationbasesin figure2 arenotproductbases.Theimagesin theleft columnindicateaswell thatthecostfor obtaininga fixedaccuracy is proportionalto thenum-berof basisfunctions.

On the other hand, we also know that with pseudo-randomsampling,thecontinuousrandomwalk algorithmandthestochasticJacobiiterativemethodsareequallyeffi-cientin practicefor constantradiosity[2]. This resultalsoholdsfor higher-orderapproximationsandcanbeverifiedby comparingthe imagesfor sameapproximationorder(andnumberof rays)in bothcolumnsof figure2. In [2] itwas shown that low-discrepancy samplingcan be muchmore effective in discretealgorithmssuch as stochasticJacobithanin the continuousrandomwalk method. Ourexperiments(not shown here)indicatedthat this remainssofor higherorderapproximations.

Other experimentssuggestedthat the efficiency gains

Page 8: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

Sto

chas

tic J

acob

i

Con

tinuo

us R

ando

m W

alk

cubi

c (1

0 un

its w

ork)

quad

ratic

(6

units

wor

k)lin

ear

(3 u

nits

wor

k)co

nsta

nt (

1 un

it w

ork)

Figure2: Higher-orderradiosityapproximationsobtainedwith continuousshootingcollisionrandomwalk radiosity[9, 6](left) and the stochasticJacobiiterative radiositymethodpresentedin this paper(right). The numberof sampleswaschosenproportionalto the numberof basisfunctionsin eachapproximationand is equalin both methods,leadingtoapproximatelyequalvarianceaswell.

Page 9: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

that can be obtainedwith the variancereduction tech-niquesdescribedin + 4.3 aresimilar asfor constantradi-osity:

� The variance reduction obtained with view-importance sampling [15] can be arbitrary highbut dependshighly on the particular scene andview point. There is a fairly high additional cost(abouta factorof 2) involved in the computationofimportancebesidesradiosity;

� The useof a constantcontrol variate[19, 1] resultsin slight improvements(typically 5-50%reductionofthe meansquareerror). The additionalcost is how-ever just a few percentof thetotal computationtime.It shouldhowever be avoided on non-closedenvir-onments,or environmentsthatcontainpolygonsthatcannotreceive any light sincethis would introducea bias in the results. Also the samplingprocedureis slightly morecomplicatedbecauseB 9 k: � x�G4 β canchangesign;

� The additionalamountof work in orderto uselinesbidirectionally is absolutelynegligible andthe tech-niqueis veryreliableandeasyto implement.Neitherdoesit requireadditionalstorage.It canyield a re-ductionof themeansquareerrorof up to a factorof2. Thereareno reasonsnot to useit.

Similar variancereductiontechniquescan be developedfor continuous(anddiscrete)randomwalk approachesaswell. In our experiencehowever, they aremoreeasyto doandappearmoreeffectivewith stochasticJacobiiterationsthanwith randomwalks.

6 Conclusion

In this paper, we have presentedthe extensionto higher-orderradiosityapproximationsof thestochasticJacobiit-erative methodpreviously proposedfor constantapprox-imationsby Neumannet al. [16, 18, 17]. As long astherequiredapproximationorderis not high, its storagecostis in practicenot significantlyhigher thanfor a constantapproximation.The computationcostfor fixedstatisticalaccuracy is proportionalto the numberof basisfunctionsin theapproximation.Thebasicalgorithmappearsequallyefficient asthe continuousrandomwalk algorithms. It ismoreefficientwhenlow discrepancy samplingis usedandwith theproposedvariancereductiontechniques.

This paperfocussedon the basic,non-hierarchicalal-gorithm.Theincorporationof hierarchicalrefinementcanbe donein thesameway asfor a constantapproximation[3].

The paperalsowassilent aboutdiscreterandomwalkmethods[27] for radiosity. A straightforward extensionof theserandomwalk algorithmsto higherorderapprox-imations[1] turnedout to beimpractical:thevariancein-creasesrapidly with averagepath lengthandapproxima-

tion orderdueto largely fluctuatingmultiplicative factorsassociatedwith eachpathsegment. Suchfactorsarenotpresentin theconstantcase.

It is known that a higherorderapproximationwill notyield better radiosity approximationsnear radiosity dis-continuities,for instanceatsharpshadow boundaries.TheMonte Carlo methodwill not reducethesediscretisationerrors.Theincorporationof selective discontinuitymesh-ing is probablythemostimportantimprovementthat canbemadeto this work.

References

[1] Ph.Bekaert.Hierarchical andStochasticAlgorithmsfor Radiosity. PhD thesis,Katholieke UniversiteitLeuven, Departmentof ComputerScience,Decem-ber1999.

[2] Ph.Bekaert,R. Cools,andY. D. Willems. An empir-ical comparisonof MonteCarloradiosityalgorithms.In 7th International Conferencein Central EuropeonComputerGraphics,VisualizationandDigital In-teractiveMedia,Plzen,Czech Republic, pages9–16,February1999.

[3] Ph. Bekaert,L. Neumann,A. Neumann,M. Sbert,andY. D. Willems. HierarchicalMonte Carlo radi-osity. In RenderingTechniques’98 (Proceedingsofthe 9th. EurographicsWorkshopon Rendering, Vi-enna,Austria), pages259–268.SpringerComputerScience,June1998.

[4] Ph. Bekaert,F. Suykens,Ph. Dutre, and J. Prikryl.RenderPark, http://www.cs.kuleuven.ac.be/˜graphics/RENDERPARK/ .

[5] Ph. Bekaertand Y. D. Willems. HIRAD: A hier-archicalhigher order radiosity implementation. In12th Spring Conference on Computer Graphics,ComeniusUniversity, Bratislava, Slovakia, pages213–218,June1996.

[6] K. Bouatouch,S.N. Pattanaik,andE.Zeghers.Com-putation of higher order illumination with a non-deterministicapproach.ComputerGraphicsForum,15(3):327–338,August1996.

[7] M. F. Cohen and D. P. Greenberg. The hemi-cube: A radiosity solution for complex environ-ments. ComputerGraphics(SIGGRAPH’85 Pro-ceedings), 19(3):31–40,July 1985.

[8] M. F. CohenandJ.R. Wallace. RadiosityandReal-istic Image Synthesis. AcademicPressProfessional,Boston,MA, 1993.

[9] M. Feda.A MonteCarloapproachfor Galerkinradi-osity. TheVisualComputer, 12(8):390–405,1996.

Page 10: The Computation of Higher-Order Radiosity Approximations ... · The Computation of Higher-Order Radiosity Approximations with a Stochastic Jacobi Iterative Method Philippe Bekaert

[10] M. Fedaand W. Purgathofer. Progressive ray re-finementfor MonteCarloradiosity. In Fourth Euro-graphicsWorkshoponRendering, pages15–26,June1993.heldin Paris,France,14–16June1993.

[11] C. M. Goral, K. E. Torrance, D. P. Greenberg,and B. Battaile. Modeling the interactionof lightbetweendiffusesurfaces. In SIGGRAPH’84 Con-ferenceProceedings(Minneapolis,MN, July 23-27,1984), pages213–222,July 1984.

[12] P. S.HeckbertandJ.Winget.Finiteelementmethodsfor globalillumination. TechnicalReportUCB/CSD91/643,ComputerScienceDivision(EECS),Univer-sity of California, Berkeley, California, USA, July1991.

[13] J. T. Kajiya. The renderingequation. ComputerGraphics(SIGGRAPH’86 Proceedings), 20(4):143–150,August1986.

[14] M. H. Kalos and P. Whitlock. The Monte Carlomethod. J.Wiley andsons,1986.

[15] A. Neumann, L. Neumann, Ph. Bekaert, Y. D.Willems, and W. Purgathofer. Importance-drivenstochasticray radiosity. In EurographicsRenderingWorkshop1996, pages111–122,June1996.

[16] L. Neumann. Monte Carlo radiosity. Computing,55(1):23–42,1995.

[17] L. Neumann,A. Neumann,andPh.Bekaert.Radios-ity with well distributedraysets.ComputerGraphicsForum, 16(3),1997.

[18] L. Neumann,W. Purgathofer, R. Tobler, A. Neu-mann, P. Elias, M. Feda, and X. Pueyo. Thestochasticray methodfor radiosity. In P. Hanrahanand W. Purgathofer, editors,RenderingTechniques’95 (Proceedingsof the Sixth Eurographics Work-shopon Rendering), July1995.

[19] L. Neumann,R. F. Tobler, andP. Elias. The Con-stantRadiosityStep. In RenderingTechniques’95(Proceedingsof theSixthEurographicsWorkshoponRendering), pages336–344.Springer-Verlag,1995.

[20] T. Nishita and E. Nakamae. Continuoustone rep-resentationof 3-D objectstakingaccountof shadowsandinterreflection.ComputerGraphics(SIGGRAPH’85 Proceedings), 19(3):23–30,July1985.

[21] S. N. Pattanaikand S. P. Mudur. Computationofglobalilluminationby MonteCarlosimulationof theparticle model of light. Third EurographicsWork-shopon Rendering, pages71–83,May 1992.

[22] S. N. Pattanaikand S. P. Mudur. Adjoint equa-tions and randomwalks for illumination computa-tion. ACM TransactionsonGraphics, 14(1):77–102,January1995.

[23] J. Prikryl, Ph. Bekaert, and W. Purgathofer.Importance-driven hierarchicalstochasticray radi-osity. In 8-th International Conferencein CentralEuropeonComputerGraphics,VisualisationandIn-teractiveDigital Media’2000(WSCG’2000),Plzen,Czech Rep. – short communicationpapers, pages100– 106,February2000.

[24] M. Sbert. An integral geometrybasedmethodforfast form-factor computation. ComputerGraphicsForum, 12(3):C409–C420,1993.

[25] M. Sbert. The use of global random directionsto computeradiosity — Global Monte Carlo tech-niques. PhD thesis, Universitat Politecnica deCatalunya,Barcelona,Spain,November1996.

[26] M. Sbert. Error and complexity of randomwalkMonteCarloradiosity. IEEETransactionsonVisual-izationandComputerGraphics, 3(1):23–38,March1997.

[27] M. Sbert, X. Pueyo, L. Neumann, and W. Pur-gathofer. Global multipathMonte Carlo algorithmsfor radiosity. The Visual Computer, 12(2):47–61,1996.

[28] P. Shirley. Radiosityvia ray tracing. In J. Arvo,editor, GraphicsGemsII , pages306–310.AcademicPress,SanDiego,1991.

[29] F. Sillion andC. Puech. Radiosityand Global Illu-mination. MorganKaufmann,SanFrancisco,1994.

[30] B. Smits,J. Arvo, andD. Salesin. An importance-driven radiosity algorithm. In ComputerGraphics(SIGGRAPH’92 Proceedings), volume 26, pages273–282,July1992.

[31] L. Szirmay-Kalos, T. Foris, L. Neumann, andC. Balasz. An analysisof quasi-MonteCarlo in-tegration applied to the transilluminationradiositymethod. ComputerGraphicsForum (Eurographics’97 Proceedings), 16(3),1997.C271–C281.

[32] R. TroutmanandN. L. Max. Radiosityalgorithmsusinghigherorderfinite elementmethods.In Com-puter Graphics Proceedings,Annual ConferenceSeries,1993, pages209–212,1993.

[33] E. Veachand L. J. Guibas. Optimally combiningsamplingtechniquesfor Monte Carlo rendering. InSIGGRAPH95ConferenceProceedings, pages419–428,August1995.

[34] H. R. Zatz. Galerkinradiosity: A higherordersolu-tion methodfor global illumination. In ComputerGraphics Proceedings,Annual Conference Series,1993, pages213–220,1993.