transfer matrix 1

28
Max-Planck-Institut Informatik Compute r Graphics Group Saarbr  ¨ ucken, Germany Massachusetts Institute of Technology Compute r Graphics Group Cambrid ge, USA Radiance Transfer Using Spherical Harmonic Gradients Master Thesis in Computer Science Thomas Annen Supervision: Prof. Dr. Hans-Peter Seidel Max-Planck-Institut Informatik Computer Graphics Group Saarbr ¨ ucken, Germany Prof. Dr. Fr ´ edo Durand Dr. Jan Kautz Massachu setts Institute of T echnology Computer Graphics Group Cambridge, USA Begin: February 24, 2004 End: September 24, 2004

Upload: avigdor-leftin

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 1/28

j k

$ 6 V ~ V © Y $ E 1 D 6 1 a |D 1 6 V z1 6 § 3 o

¥ ¬

¥ ± °S E © ²t ²

¥

°Y

¿Á Àu ÂV Ãy Ä ÅV Ã Æ ÇÉ È½ Ê

Ë

ÄD ÄD Ì

Í CD p) qa r sÎ RE I§ T sE WE U¥ Qt rE vE R

Ï@ ¢ ¤@ p) qa r sÎ RE I§ T sE WE U¥ Qt r s¥ s

Ð¥ ÑV Ò ÓV ÓV ÔV Õ1 ÖV × ØV Ù Ó Ú ÛÜ Ö ×¥ ÝS Û Þ Ò

µY ßY ¥ àt " á E " ã â ´ äo ¶u ¶ ¶

¥ è æ é´ êë äo ¶u ¶ ¶

¥ ¹ï V ¾ç É ) ° E ¹) 3 á) © @ ç u ®G 3 u u E ¥ âG ® E © u

ò3 û1 ü õ¥ ýS þG ÿ3 ÷¡ 3 óS õ£ ¢± ýS û1 ö& óS ÷¤ õ¥ ó¥ ¢§ ¦G õ§ ö& ýS ÷t øo ü þ© ýo û ñ© ¨ú ù ü õ 3 ýu òE ñ

" © u âG âf " ¬© ¸ ½ ° ) " ! P " ¥ " àt ¹G " ¬

#u o Á ¥ ) ã æ é% $ êë äo ¶u ¶ ¶ 3 G 6 " E " ) " « ª« ¬ )

© '

Max-Planck-Institut InformatikComputer Graphics GroupSaarbr ucken, Germany

Massachusetts Institute of TechnologyComputer Graphics GroupCambridge, USA

Radiance Transfer UsingSpherical Harmonic Gradients

Master Thesis in Computer Science

Thomas Annen

Supervision: Prof. Dr. Hans-Peter Seidel

Max-Planck-Institut Informatik Computer Graphics GroupSaarbr ucken, Germany

Prof. Dr. Fr edo DurandDr. Jan Kautz

Massachusetts Institute of TechnologyComputer Graphics GroupCambridge, USA

Begin: February 24, 2004End: September 24, 2004

Page 2: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 2/28

Contents

1 Problem Statement and Overview 1

2 Introduction 4

3 Previous Work 6

4 Theory of Spherical Harmonic Gradients 74.1 Review: Shading with Spherical Harmonics . . . . . . . . . . . . 74.2 Spherical Harmonic Gradients . . . . . . . . . . . . . . . . . . . 8

4.2.1 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2.2 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . 10

5 Rendering with SH Gradients 115.1 SH Coefcient Extrapolation using the Gradient . . . . . . . . . . 115.2 SH Coefcient Interpolation using the Gradient . . . . . . . . . . 12

6 Results 136.1 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7 Conclusion and Future Work 18

8 Appendix 19

i

Page 3: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 3/28

Figures

1.1 Buddha shaded with PRT. (Courtesy of Sloan et al.) . . . . . . . . 2

2.1 PRT for localized area lights. . . . . . . . . . . . . . . . . . . . . 4

4.1 Change in angular domain . . . . . . . . . . . . . . . . . . . . . 8

5.1 Visibility changes . . . . . . . . . . . . . . . . . . . . . . . . . . 12

6.1 Max-Planck model under local light changes . . . . . . . . . . . . 136.2 Bird model rendered with only a single sample (no gradient), sin-

gle sample with gradient, and ground truth. . . . . . . . . . . . . 146.3 Incident radiance reconstruction. . . . . . . . . . . . . . . . . . . 146.4 Incident radiance reconstruction using SH Gradients. . . . . . . . 15

6.5 Single-sampling versus multi-sampling and gradients versus nogradients. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166.6 RMS error of extrapolated radiance for the tooth example. . . . . 17

ii

Page 4: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 4/28

Chapter 1

Problem Statement and Overview

Computer graphics has been advancing continuously during the last decades. Ren-dering quality has improved due to innovative new algorithms on one side, andon the other side hardware manufacturer producing more exible and powerfulgraphics chips for the broad market. Latest NVIDIA and ATI Graphics Process-ing Units (GPUs) allow to create astonishing real-time effects for both the high-end visual effects community and for consumer level applications, such as games.However, despite of all this great algorithmic and engineering advancement, it isstill not possible to perform real-time global illumination without using massivecomputational power of many CPUs. For instance, Wald et al. [WKB ∗02, Wal04]presented a highly optimized ray-tracing system running on a cluster of PCs. De-pending on the resolution and number of cluster nodes they are able to computeglobal illumination in real-time even for dynamic scenes. The reason why globalillumination requires so any resources is not that the algorithms are so compli-cated themselves, but that their evaluation has to be done at a dense set of samplesover the scene which is therefore very costly. As a consequence, most interac-tive and real-time applications use simplied local lighting models, even neglect-ing visibility, and assume simple material properties to achieve high frame rates.Whereas in reality, most materials have complex reection properties, which areusually not easy to model. Furthermore, lighting conditions are often to com-

plex to be modeled by a simple point or directional light source, as often used bylocal lighting models. In order to account for global effects (like soft-shadows,object interreections, refraction, etc.) it is necessary to calculate an expensiveshading integral at every visible surface point. Because of these barriers, display-ing realistic images quickly is so far limited to afore-mentioned high-performancerendering systems.

However, in 2002 Sloan et al. [SKS02] presented a novel transport operatorcalled Precomputed Radiance Transfer (PRT) that alleviates these restrictions if certain criteria hold. PRT is applicable to rendering static scenes illuminated by

1

Page 5: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 5/28

innitely distant low-frequency environments. Depending on the scene complex-ity, it yields interactive or even real-time frame rates while displaying soft shad-ows, interreections, color bleeding, etc. Figure 1.1 shows the result of shading abuddha statue with PRT. This also illustrates that PRT is not limited to solid mod-els (see Figure 1.1(a)), but can also handle translucent objects (see Figure 1.1(b)).

This is possible because PRT does all expensive lighting computations off-line, and only the reconstruction of the shading integral is done during render-ing, which turns out to be a cheap operation. Key to this is to split the shad-ing integral into two parts: the incident radiance and the energy response overthe object (this includes the material BRDF and the visibility function), and to project the result for both in lower order Spherical Harmonic (SH) basis. At the

end of the precomputation, incident radiance as well as the light transfer overthe surfaces are compactly described in one lighting vector and a transfer matrix(for diffuse objects the matrix reduces to a vector) for each vertex respectively.

(a) Solid (b) Translucent

Figure 1.1: Buddha shaded with PRT. (Cour-tesy of Sloan et al.)

What makes PRT feasable is thatthe reconstruction during runtimeis very cheap, because it is inde-pendent of the complexity of theprecomputation. The reconstruc-tion itself only involves a sim-ple per-vertex matrix-vector prod-

uct for glossy surfaces and evenonly a dot product for objectswith a Lambertian BRDF. Thiscan easily be done utilizing a ver-tex shader on todays commoditygraphics hardware. The dimen-sion of the SH lighting vector andthe transfer matrix is determinedby the SH band L used to recon-struct a given signal dened overthe spherical domain.

The reason for the innitely distant lighting environment assumption is madebecause it permits to compute the SH lighting coefcients only for one point (usu-ally the centroid of an object) and to reuse this vector at all vertices. This furtherimproves execution speed of PRT algorithms, but also exhibits shading artifactswhen lighting is more localized. Currently, the only solution to achieve convinc-ing image quality for such scenarios of nearby area lights is an expensive multi-sampling scheme, where irradiance is sampled at many points distibuted over theobject [SKS02].

In contrast to the costly multisampling, we suggest in this master thesis to

2

Page 6: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 6/28

compute the Spherical Harmonic Gradients of the lighting coefcients for a cer-tain sampling position and to extrapolate a new SH lighting coefcient vector atdifferent spacial locations. The main goal of this thesis is to derive an analyticformula to compute this gradient and to show that SH Gradients yield much bet-ter image quality than multisampling alone. We will discuss the small additionaloverhead for the gradient computation and show some results comparing multi-sampling and our new method. We assume that the reader has a basic understand-ing of SHs as we will only review the concept of using them for shading briey.Please refer to [Kau03, Ram02, Edm60] for a detailed description and overviewof SHs.

The structure of this Master Thesis is as follows: First, we give a brief intro-

duction before we discuss most relevant related work and compare some previousmethods to our algorithm. The previous work chapter is followed by a reviewof the basic concept of shading with SHs in order to provide the reader a basicbackground to follow the main concept. This leads us to the theoretical frame-work presenting an analytic formula to derive the gradient. After the mathmaticalcontribution is elaborated, we describe how the gradient is built in the shadingprocess that was described earlier. As our method is a rst order approximation,the next chapter discusses the limitations, presents an error analysis, and proposeshow visual artifacts can be further minimized in problematic cases. Finally, weshow results for dynamic scenes, give the timings and compare our technique to

the standard SH lighting and the multisampling scheme. At the end we concludeour work and present an outlook for future work and ideas we want to investigate.

Acknowledgements

The presented master thesis is based on research conducted during my three monthvisit in the Computer Graphics Group at MIT Cambridge, USA. I owe specialthanks to my supervisors Dr. Jan Kautz, Prof. Dr. Fr edo Durand from MIT andProf. Dr. Hans-Peter Seidel from MPI Informatik for their enormous help andadvice during this time.

Futhermore, I want to thank all my colleagues of both computer graphicsgroups at MIT and MPI Informatik for their support and valuable discussions.I especially want to thank the following people (alphabetical order):

Volker Blanz, Stefan Brabec (now at TomTec), Eric Chan, Michael Goesele,Paul Green, Eugene Hsu, Hendrik Lensch (now at Stanford University), WojciechMatusik (now at MERL), Karol Myszkowski, and Matthias Zwicker.

3

Page 7: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 7/28

Chapter 2

Introduction

In recent years, several methods have been proposed that permit the usage of global incident lighting in real-time rendering [SKS02, NRH03, SHHS03] (seeFigure 1.1). These approaches represent the incident radiance in spherical har-monics (SH). They, however, assume distant lighting. As a result, they are in-capable of rendering scenes with mid-range lighting effects without visual error.Figure 2.1 depicts a hand model shaded using various means. Figure 2.1(a) showsonly one sample at the center. Figure 2.1(b) illustrates the same model shadedusing one sample and the analytical gradient, as we propose. The last image inFigure 2.1 shows a reference rendering where the incident radiance eld is sam-pled per-vertex. To alleviate this problem, Sloan et al. [SKS02] sample the inci-dent light eld at multiple points over the object. While this was shown to be apossible solution, the high computational cost of multiple sampling leaves roomfor improvement.

In this thesis, we propose to compute a rst-order Taylor expansion of thespherical harmonic coefcients around a sampling point [AKDS04]. We show

(a) Single sample (b) Analytic Gradient (c) Reference (per-vertex)

Figure 2.1: PRT for localized area lights.

4

Page 8: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 8/28

how the gradient of the incident radiance (represented in SH) can be computedfor little additional cost compared to the coefcients alone. A semi-analyticalformula is introduced to calculate this gradient at run-time. The incident radiancecan now be extrapolated to different positions around the original sample location.In case of multiple samples, the interpolation quality is greatly improved, thusrequiring less samples. Extrapolation/interpolation can be easily performed in avertex shader on the GPU. The extrapolated/interpolated incident radiance canthen used together with any radiance transfer technique, e.g. [RH01, SKS02].

5

Page 9: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 9/28

Chapter 3

Previous Work

Our work uses the same framework as the recent precomputed radiance transfer (PRT) technique [SKS02]. This approach permits the illumination of objects withlow-frequency incident lighting represented in spherical harmonics [Edm60]. Theobject can either be diffuse [SKS02] or glossy [KSS02, SHHS03, LK03]. Ren-dering can be performed in real-time, but requires precomputing the transfer forself-shadowing and other global illumination effects. PRT is limited to distant il-lumination, unless multiple incident radiance samples are taken and interpolated[SKS02]. We improve on this by computing the gradient of the spherical harmon-ics coefcients around a sample point. This enables extrapolation of the incidentradiance to other points in space, which in turn can be used to improve interpola-tion of multiple samples.

Our technique is similar in spirit to the irradiance gradients for ray-tracingby Ward and Heckbert [WH92]. They propose to compute gradients of the view-independent irradiance at various sample points in order to improve interpolation.This involves a translational gradient (for the change of position) as well as ro-tational gradient (for the change of relative surface orientation). In contrast totheir work, we choose to compute a gradient for the whole sphere of incident ra-diance (given in SH), independent of any incident surface orientation. Thereforewe only need a translational gradient, but not the rotational gradient. However,

our gradient is higher-dimensional, as we encode the directional radiance infor-mation through the vector of lighting coefcients. Essentially, we trade dependen-cies on the receiver orientation for a more comprehensive directional treatment of incident radiance. Furthermore, we focus on real-time rendering, whereas theirapplication area was ofine rendering. Irradiance gradients were generalized byArvo [Arv94], who additionally accounted for occlusions. As Ward and Heckbert,we have to decided to neglect occlusion changes. This is motivated by implemen-tation robustness and simplicity goals, and is justied by the use of low-frequencyincident illumination, which is not very susceptible to visibility changes.

6

Page 10: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 10/28

Page 11: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 11/28

n(x)n(x)

dA(x)dA(x) x

p

x

s

p

s

’p d

Figure 4.1: At a point p , we see point x in direction s := x − p . The point x has adifferential solid area dA(x ). When we move from p to p along d , the directions changes, as well as the angle between s and n .

To alleviate this problem, Sloan et al. [SKS02] propose to take multiple in-cident radiance samples at several p j and interpolate between the I p j . We alsopropose to use multiple samples in these cases, but increase interpolation qualityusing our gradient-based technique.

4.2 Spherical Harmonic GradientsConsider the conguration visualized in Figure 4.1. A single sample of incidentradiance is taken at point p . We want to estimate the incident radiance I p (ω) at anew point p = p + d , where d is simply the translation vector. More precisely,we want the coefcient vector I p .

We approximate the coefcients I p = ( c0 , c1 , . . .)T at point p with a rst-order Taylor expansion:

ci = ci + ( ci · d ). (4.4)

As we will show in the next section, the gradients ci can be computed efciently

and allows for fast rendering.Assumptions. Before we derive the gradient formulation, we introduce the as-sumptions we make. We neglect specular surfaces in the environment and assumethat exitant radiance at a 3D point is independent of direction. This assumptionis made only for the environment contribution, and the illuminated object can bespecular.

Furthermore, we assume that visibility does not change when we move awayfrom p . That is, the set of visible points remains unchanged. Although this as-sumption almost never holds for real scenes, artifacts are likely to be negligible,

8

Page 12: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 12/28

since we consider only low-frequency incident illumination. If visibility changesare dramatic and artifacts might occur, multiple samples and gradient-based inter-polation can be used to circumvent potential problems (see Section 5.2).

4.2.1 Gradient

We need to compute the gradient of the coefcients ci . Projecting the incidentradiance into spherical harmonics is done by integrating it against the SH basisfunctions:

ci = Ωyi (ω) I (ω) dω. (4.5)

Similar to the rendering equation, this formula can be written as an integralover the sphere of directions Ω or over visible scene surfaces S . For gradientcomputation, this choice will inuence which terms of the integrand need to bederived and which ones are constant. Both approaches yield similar algebraiccomplexity, but different numerical integration. In the surface-based case, dif-ferential surface elements are assumed xed and we need to derive the variousangular terms (see Figure 4.1). In contrast, in the angle integration, we assumethat angles are xed but the derivatives of radiance over the scene surfaces needsto be computed. The former approach is simpler because it makes a direct use of the environment-map-sampled representation of the surface elements and becausethe angular terms are simple to derive, as shown below.

We thus rewrite this integral so that integration is performed over visible sur-faces S . We rst dene the non-unit vector s = ( x − p ), where x is a point on avisible surface, substituting it into Equation 4.5:

ci = S yi (

s|| s ||

) I (x ) ds . (4.6)

The main difference is that the incident radiance now depends on the points x of the visible surfaces S . This is useful for taking the gradient, since the radianceleaving x remains the same, even when the sample location p moves to p .

The measure ds can be rewritten as the differential surface area dA at x

weighted by the squared distance to that surface point and by the angle betweenthe surface normal n (x ) and the direction s towards p [CW93]:

ds = dAn (x ) · (s / || s || )

|| s || 2 . (4.7)

We explain how to compute dA in practice in the next section. We then write thegradient of ci :

ci = − S yi (

s|| s ||

)n (x ) · (s / || s || )

|| s || 2 I (x ) dA (4.8)

9

Page 13: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 13/28

Note, that we take the gradient in s instead of p , since it is easier to write. Theonly difference between the two gradients is the sign (when p moves along d , thens moves along − d ). Note also, that because we use the integration on surfaces,the incident radiance I (x ) does not vary under translation of the incident point.

To simplify notations we dene the geometric term

g(s ) =n (x ) · (s / || s || )

|| s || 2 (4.9)

and Equation 4.8 becomes

ci = − S yi (

s

|| s || ) · g(s) I (

x) dA, (4.10)

which we expand using the derivative of a product to

ci = − S yi (

s|| s ||

) · g(s) + yi (s

|| s ||) · g(s) I (x ) dA. (4.11)

The gradients of the geometric term is simply:

g(s ) =n (x )|| s || 3 − 3s

(n (x ) · s)|| s || 5 . (4.12)

The gradient of the spherical harmonics yi can be easily derived analytically.It is convenient to use the Cartesian formulation [VMK88], as we compute thetranslational gradient in Cartesian coordinates. The recursion on Legendre poly-nomials can also be exploited. We provide C code for these terms online.

Note, that the integrand of Equation 4.11 is analytical. The actual integrationis performed numerically, as some quantities ( I (x ), the normal n (x ), and dA)come from sampled representations (cube maps in our case).

4.2.2 Discussion

The gradient formulation in Equation 4.11 has the additional advantage that onecan tabulate the translational gradient of the spherical harmonics for each texellocation. By applying the chain-rule and factoring 1/ || s || 2 outside this term, theintegrand can be precomputed for unit directions ω and does not need to be re-computed.

In this thesis we only show examples of objects with diffuse surfaces andprecomputed radiance transfer. Glossy surfaces [SKS02, SHHS03] as well asnon-shadowed objects [RH01] can be incorporated the same way. Just the naldot-product (Equation 4.3) is replaced with a different operation.

10

Page 14: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 14/28

Chapter 5

Rendering with SH Gradients

5.1 SH Coefcient Extrapolation using theGradient

Rendering an object using the SH gradient, involves the following steps.First, we pick a single sample location (usually the centroid of an object)

and render a cube map containing exit radiances I (x ) of the surrounding ob- jects/emitters. Additionally, we read back the depth-buffer, as we need to knowthe distance r from p to x for each texel. In a separate pass we render the emittersagain but with color-coded normals, which we also read back yielding n (x ).

We go over each texel t of the cube maps and analytically evaluate the inte-grand. The numerical integration over all texels provides the gradients ci . Theterm dA can be computed from the read-back data as follows:

dA = dωtr 2

n (x ) · ω, (5.1)

where dωt is the solid angle of the texel t , ω is the unit direction from p towardsx , and r is the distance from p to x .

At each vertex of the object, we now compute the estimated coefcients:

ci = ci + ( ci · d ). (5.2)

These coefcients are then used to compute the nal exitant radiance using thedot-product between the coefcients ci and the cosine-weighted visibility coef-cient vector V ∗

p (see Equation 4.3).We currently compute the gradients on the CPU. The new coefcients ci as

well as the nal dot-product are computed in a vertex shader on the GPU.

11

Page 15: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 15/28

5.2 SH Coefcient Interpolation using the Gradient

If light is emitted from nearby or overlapping sources, a single extrapolated sam-ple might not be sufcient due to parallax changes. Such a scenario is sketched inFigure 5.1. If SH coefcients are computed only at object O i ’s center, then vertexv would not be shaded properly, because object O i+ 2 is becomes visible from thisv . Shading for objects with larger extend requires interpolation between multi-ple sample points in order to achieve faithful results [WH92]. In such a case, we

O i

O i+2

v

Object O i+1occludes O i+2

Object O i+2 is visiblefrom vertex v

Object O i exhibits shadingartifacts due to occlusion

O i+2

O i+1

Figure 5.1: Due to visibility changes, a previously hidden object becomes visible.

choose N sample points p j over the object (using Sloan et al.’s method [SKS02]).The incident radiance coefcients c j

i as well as the gradient c ji is computed for

each sample point p j .At each vertex of the object, we compute the estimated coefcients as a weighted

sum of all extrapolated samples:

ci = j

w j c ji + c j

i · d j , (5.3)

where w j is a weight based on the distance between the vertex position v and thesample point position p j . We use a simplied version of Ward and Heckbert’sformula [WH92], which was also employed by Sloan et al. [SKS02]:

w j =(1/ v − p j )b

i (1/ v − p i )b . (5.4)

If only a few samples are used, then rendering can be done in a shader on theGPU. Note, that the gradient-based interpolation scheme could also be used to im-prove interpolation of the irradiance volumes technique of Greger et al. [GSHG98].

12

Page 16: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 16/28

Chapter 6

Results

For all the results, presented in this section we have used a 3 GHz PC, equippedwith 2 GB RAM and an NVIDIA Quadro FX 3000 (NV35-GL) graphics board.The viewport size for all renderings was 512 × 512. The size of a single cubemap face, into which we read back the necessary data from the frame buffer, was64 × 64.

The strength of the gradient method can be illustrated by moving an objectbelow a small and local area light, see Figure 6.1. In this example, we computethe original incident lighting sample and the gradient only once at the center of thehead in the middle image. We then move the head from left to right underneath thelight. Shading is computed with our gradient method based on the single sample.Shading responds correctly to the change of location.

Figure 6.1: Max-Planck model moved underneath a local emitter from left toright. The incident lighting is only sampled once at the center of the head (middleimage).

Figure 6.2 shows a bird model lit by three different colored area light sources.It compares a single sample with the gradient-based technique and ground truth.The same comparison is made in Figure 2.1. These comparisons highlights thequality improvement due to our method. One can see that our gradient methodproduces results very similar to the actual ground truth.

13

Page 17: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 17/28

(a) Center sample (b) SH gradient (c) Ground truth

Figure 6.2: Bird model rendered with only a single sample (no gradient), singlesample with gradient, and ground truth.

In Figure 6.3(a) we visualize a cubemap rendered at the center of the birdmodel, which represents incoming lighting (red, green, and yellow area lights). InFigure 6.3 (b), (c), and (d) we plot the reconstruction of the incident lighting usingSH band L= 3, 4, and 5 respectively.

In Figure 6.4, we show again the cubemap rendered at the center (see Fig-

ure 6.4(a)) and a sampling result at a different location (see Figure 6.4(b)), to

(a) Reference cubemap

(b) Reconstruction L=3 (c) Reconstruction L=4 (d) Reconstruction L=5

Figure 6.3: Incident radiance reconstruction.

14

Page 18: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 18/28

(a) Object center (b) Translated by x = 5

(c) SH Gradients reconstruc-tion

(d) Reference reconstruction

Figure 6.4: Incident radiance reconstruction using SH Gradients.

which we want to extrapolate a new coefcient vector. Figure 6.4(c) visualizesthe irradiance reconstruction at this location using a SH vector extrapolated byour gradient. As one can see it compares very well to the reference reconstruc-tion shown in Figure 6.4(d), where the SH coefcients were computed at the newspatial location.

In Table 6.1, we list the rendering times for the previous technique (no gradi-ent) and our proposed technique (with gradient). Performance is very similar forboth methods, but quality is increased by using our method.

single withModel #vertices sample gradientPlanck 25K 23.8 19.7Bird 32K 8.4 7.9

Tooth 2.5K 40.3 34.5Table 6.1: Rendering times in frames per second for different models and differenttechniques.

In Figure 6.5, a tooth model is illuminated by partially overlapping emitters.Different renderings compare extrapolation of a single sample against interpola-tion of eight samples. In Figure 6.5(a) we see the standard method of using justa center sample with no additional gradient information. Whereas Figure 6.5(b)uses a single sample with a gradient which does similarly well as eight samples

15

Page 19: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 19/28

(a) single sample (b) single gradient (c) ground truth

(d) eight samples (e) eight samples (f) eight gradients

Figure 6.5: Single-sampling versus multi-sampling and gradients versus no gradi-ents.

without gradients (see Figure 6.5(e)). Eventhough the single sample plus the gra-dient is close to the eight samples result, it still does not get close to the groundtruth, shown in Figure 6.5(c). The only noticeable difference is the top of thetooth. Here visibility changes should make it mainly bluish, but the extrapolatedsingle sample is purple. That is caused by the blue light source, which occludesthe red one. In such cases where visibility changes we can circumvent visual arti-

facts, by adding gradient information to the multiple samples distributed over thetooth as depicted in Figure 6.5(d). As Figure 6.5(f) proofes, interpolation of eightsamples with gradients produces virtually the same result as the reference imagewhich is almost indistinguishable from the ground trouth.

16

Page 20: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 20/28

6.1 Discussion

In our experience, a single sample using the gradient is often sufcient. Only forvery nearby emitters—where “nearby” means closer than the distance from thesample position to the object’s bounding box (empirically determined)—we havefound that one needs multiple samples. In these cases the 1/r 2 falloff is veryimportant and cannot be modeled by our rst-order approximation. In the case of overlapping emitters and occlusion changes, multiple samples are needed as well.We have only experimented with a xed number of samples for now. For all thecases we have tried, up to 8 samples seem to be sufcient. Figure 6.6 depicts theRMS error between ground truth and extrapolated incident radiance from a single

sample (tooth example, see Figure 6.5). The red curve includes occlusion changes,the green curve does not (blue blocker removed from scene) The error is shownfor the red color channel only. The red error curve includes the blue emitter as ablocker, whereas the green error curve is computed with the blue emitter removedfrom the scene (no occlusion changes). As expected, the error is higher whenocclusion changes occur, but not signicantly.

0

5

10

15

20

25

30

35

40

45

50

-15 -10 -5 0 5 10 15

R M S E r r o r

Distance to Sample

RMS R occlusionRMS R no occlusion

Figure 6.6: RMS error of extrapolated radiance for the tooth example.

17

Page 21: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 21/28

Chapter 7

Conclusion and Future Work

We have presented a method for efcient shading of objects that are lit with nearbyarea sources. We extrapolate/interpolate incident radiance based on a rst-orderapproximation. To this end, we have derived an analytic formula for the gradient,which can be efciently computed at run-time.

Using this additional information, we achieve results close to a per-vertex ref-erence while the additional cost is small. Simple extrapolation has limitations interms of accuracy, namely when extrapolation is done at locations far from theinitial sample position. Interpolation of multiple samples maintains good imagequality in these cases.

We would like to implement a robust and automatic scheme for selecting sam-ple positions in dynamic scenes. New samples should be generated or removedbased on the spatial relationship between objects.

Furthermore, we would like to experiment with higher-order Taylor expan-sions. This should allow even better quality without taking multiple samples of the incident radiance. It would be interesting to nd out at which order the com-putation of the Taylor expansion becomes more expensive than taking multiplesamples.

18

Page 22: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 22/28

Chapter 8

Appendix

In this chapter we want to present 25 plots which illustrate how each single SHcoefcient behaves, when it is computed along a line in space, which was startingfrom sampling position (p − d ) and expanding to (p + d ), where d = (5 , 0, 0). Asexpected, higher order SH coefcients oscillate more and are therefore not wellapproximated using a 1st oder Taylor approximation.

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 0

Distance

R of SH-C 0G of SH-C 0B of SH-C 0

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1

Distance

R of SH-C 1G of SH-C 1B of SH-C 1

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 2

Distance

R of SH-C 2G of SH-C 2B of SH-C 2

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 3

Distance

R of SH-C 3G of SH-C 3B of SH-C 3

19

Page 23: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 23/28

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 4

Distance

R of SH-C 4G of SH-C 4B of SH-C 4

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 5

Distance

R of SH-C 5G of SH-C 5B of SH-C 5

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 6

Distance

R of SH-C 6G of SH-C 6B of SH-C 6

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 7

Distance

R of SH-C 7G of SH-C 7B of SH-C 7

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 8

Distance

R of SH-C 8G of SH-C 8B of SH-C 8

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 9

Distance

R of SH-C 9G of SH-C 9B of SH-C 9

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 0

Distance

R of SH-C 10G of SH-C 10B of SH-C 10

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 1

Distance

R of SH-C 11G of SH-C 11B of SH-C 11

20

Page 24: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 24/28

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 2

Distance

R of SH-C 12G of SH-C 12B of SH-C 12

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 3

Distance

R of SH-C 13G of SH-C 13B of SH-C 13

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 4

Distance

R of SH-C 14G of SH-C 14B of SH-C 14

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 5

Distance

R of SH-C 15G of SH-C 15B of SH-C 15

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 6

Distance

R of SH-C 16G of SH-C 16B of SH-C 16

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 7

Distance

R of SH-C 17G of SH-C 17B of SH-C 17

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 8

Distance

R of SH-C 18G of SH-C 18B of SH-C 18

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 1 9

Distance

R of SH-C 19G of SH-C 19B of SH-C 19

21

Page 25: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 25/28

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f

f i c i e n t 2 0

Distance

R of SH-C 20G of SH-C 20B of SH-C 20

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f

f i c i e n t 2 1

Distance

R of SH-C 21G of SH-C 21B of SH-C 21

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 2 2

Distance

R of SH-C 22G of SH-C 22B of SH-C 22

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 2 3

Distance

R of SH-C 23G of SH-C 23B of SH-C 23

-1

-0.5

0

0.5

1

-6 -4 -2 0 2 4 6

S H

C o e f f i c i e n

t 2 4

Distance

R of SH-C 24G of SH-C 24B of SH-C 24

22

Page 26: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 26/28

Bibliography

[AKDS04] A NNEN T., K AUTZ J., D URAND F., S EIDEL H.-P.: Spherical har-monic gradients for mid-range illumination. In Rendering Techniques2004 Eurographics Symposium on Rendering (Norrk oping, Sweeden,June 2004), Wann Jensen H., Keller A., (Eds.), Eurographics Associ-ation, Eurographics Association, pp. 331–336.

[Arv94] A RVO J.: The Irradiance Jacobian for Partially Occluded PolyhedralSources. In Proceedings of SIGGRAPH 94 (July 1994), ComputerGraphics Proceedings, Annual Conference Series, pp. 343–350.

[CW93] C OHEN M., W ALLACE J.: Radiosity and Realistic Image Synthesis .Academic Press Professional, Cambridge, MA, 1993.

[Edm60] E DMONDS A.: Angular Momentum in Quantum Mechanics . Prince-ton University, Princeton, NJ, 1960.

[GSHG98] G REGER G., S HIRLEY P., H UBBARD P., G REENBERG D.: TheIrradiance Volume. IEEE Computer Graphics And Applications 18 , 2(1998), 32–43.

[Kau03] K AUTZ J.: Realistic, Real-Time Shading and Rendering of Objectswith Complex Materials . Cuvillier Verlag, G ottingen, 2003.

[KSS02] K AUTZ J., S LOAN P.-P., S NYDER J.: Fast, Arbitrary BRDF Shading

for Low-Frequency Lighting Using Spherical Harmonics. In 13th Eurographics Workshop on Rendering (June 2002), pp. 301–308.

[LK03] L EHTINEN J., K AUTZ J.: Matrix Radiance Transfer. In Proceedingsof the 2003 symposium on Interactive 3D graphics (2003), pp. 59–64.

[NRH03] N G R., R AMAMOORTHI R., H ANRAHAN P.: All-Frequency Shad-ows Using Non-linear Wavelet Lighting Approximation. ACM Trans-actions on Graphics 22 , 3 (2003), 376–381.

23

Page 27: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 27/28

[Ram02] R AMAMOORTHI R.: A Signal-Processing Framework for Forward and Inverse Rendering . PhD thesis, ‘Stanford University, August2002.

[RH01] R AMAMOORTHI R., H ANRAHAN P.: An Efcient Representation forIrradiance Environment Maps. In Proceedings of ACM SIGGRAPH 2001 (August 2001), ACM Press, pp. 497–500.

[SHHS03] S LOAN P.-P., H AL L J., H ART J., S NYDER J.: Clustered PrincipalComponents for Precomputed Radiance Transfer. ACM Transactionson Graphics 22 , 3 (2003), 382–391.

[SKS02] S LOAN P.-P., K AUTZ J., S NYDER J.: Precomputed Radiance Trans-fer for Real-Time Rendering in Dynamic, Low-Frequency LightingEnvironments. ACM Transactions on Graphics 21 , 3 (2002), 527–536.

[VMK88] V ARSHALOVICH D., M OKSALEV A., K HERSONSKII V.: QuantumTheory of Angular Momentum . World Scientic Publishing Co., Sin-gapore, 1988.

[Wal04] W ALD I.: Realtime Ray Tracing and Interactive Global Illumination .PhD thesis, Computer Graphics Group, Saarland University, 2004.

Available at http://www.mpi-sb.mpg.de/ ∼ wald/PhD/.

[WH92] W ARD G., H ECKBERT P.: Irradiance Gradients. In Third Eurograph-ics Workshop on Rendering (1992), pp. 85–98.

[WKB ∗02] WALD I., K OLLIG T., B ENTHIN C., K ELLER A., S LUSALLEK P.:Interactive global illumination. In 13th Eurographics Workshop on Rendering (June 2002), pp. 9–20.

24

Page 28: Transfer Matrix 1

8/6/2019 Transfer Matrix 1

http://slidepdf.com/reader/full/transfer-matrix-1 28/28

Eidesstattliche Erkl arung

Hiermit erkl are ich an Eides Statt, dass ich die vorliegende Mas-terarbeit selbst andig und ohne fremde Hilfe verfasst habe. Ichhabe dazu keine weiteren als die angef uhrten Hilfsmittel benutztund die aus anderen Quellen entnommenen Stellen als solchegekennzeichnet.

Saarbr ucken, September 24, 2004

Thomas Annen