A Practical Guide to Global Illumination Using Photon Maps
Total Page:16
File Type:pdf, Size:1020Kb
A Practical Guide to Global Illumination using Photon Maps Siggraph 2000 Course 8 Sunday, July 23, 2000 Organizer Henrik Wann Jensen Stanford University Lecturers Niels Jørgen Christensen Technical University of Denmark Henrik Wann Jensen Stanford University Abstract This course serves as a practical guide to photon maps. Any reader who can implement a ray tracer should be able to add an efficient implementation of photon maps to his or her ray tracer after attending this course and reading the course notes. There are many reasons to augment a ray tracer with photon maps. Photon maps makes it possible to efficiently compute global illumi- nation including caustics, diffuse color bleeding, and participating media. Photon maps can be used in scenes containing many complex objects of general type (e.g. the method is not restricted to tessel- lated models). The method is capable of handling advanced material descriptions based on a mixture of specular, diffuse, and non-diffuse components. Furthermore, the method is easy to implement and ex- periment with. This course is structured as a two hour tutorial. We will therefore assume that the participants have knowledge of global illumination algorithms (in particular ray tracing), material models, and radio- metric terms such as radiance and flux. We will discuss in detail photon tracing, the photon map data structure, the photon map ra- diance estimate, and rendering techniques based on photon maps. We will emphasize the techniques for efficient computation through- out the presentation. Finally, we will present some examples of scenes rendered with photon maps and explain the important aspects that we considered when rendering each scene. Lecturers Niels Jørgen Christensen Associate professor Department of Graphical Communication Technical University of Denmark Building 116 2800 Lyngby Denmark [email protected] Professor Niels Jørgen Christensen has been conducting research in computer graphics including global illumination, virtual reality, parallel rendering tech- niques and scientific visualization at the Technical University of Denmark for the last 20 years. He was the Ph.D. advisor for Henrik Wann Jensen and co-author on the first papers on photon maps. Henrik Wann Jensen Research Associate Computer Graphics Laboratory Computer Science 362B Stanford University CA 94305 [email protected] http://graphics.stanford.edu/˜henrik Henrik Wann Jensen is a research associate in the computer graphics labora- tory at Stanford where he is working on light scattering and global illumination techniques for complex environments and parallel rendering algorithms. Prior to that he was a postdoc in the computer graphics group at MIT. He received his M.Sc. in 1993 and his Ph.D. in 1996 at the Technical University of Denmark for developing the photon map algorithm. Course Syllabus 5 minutes: Introduction and Welcome Henrik Wann Jensen Why you should attend this course. Overview of the topics. 30 minutes: Overview of Existing Global Illumination Al- gorithms Niels Jørgen Christensen A brief overview of the photon map algorithm including a description of the important differences compared to other global illumination algorithms such as finite element methods (radiosity) and brute force Monte Carlo ray tracing. 30 minutes: Photon Tracing: Building the Photon Maps Niels Jørgen Christensen & Henrik Wann Jensen This part of the tutorial will cover efficient techniques for: • Emitting photons from the light sources in the scene using projection maps • Simulating scattering and absorption of photons using Russian Roulette • Storing photons in the photon map • Preparing the photon map for rendering Also the use of several photon maps for the simulation of caustics, indirect illumination, and participating media will be described. 55 minutes: Rendering using Photon Maps Henrik Wann Jensen The third part of the tutorial will describe how the photon maps are used to simulate global illumination. This part will give details on how to com- pute a radiance estimate based on the photon map, and how to filter this estimate to obtain better quality with fewer photons. Also described will be techniques for efficiently locating the nearest photons. The rendering pass will be detailed with a description of how the rendering equation is split into several components that each can be rendered using specialized techniques based on the photon maps. This includes methods for rendering caustics, indirect illumination, and participating media. Finally, we will give some examples of different scenes rendered using photon maps, describe how the photon maps were used, and discuss the issues that are important to ensure good quality and fast results. Contents Foreword 7 0 Introduction 8 0.1Motivation............................... 8 0.2Whatisthephotonmapalgorithm?................. 8 0.3Overviewofthecoursematerial................... 9 A Practical Guide to Global Illumination using Photon Maps 11 1 Photon tracing 11 1.1Photonemission............................ 11 1.1.1 Emissionfromasinglelightsource............. 11 1.1.2 Multiplelights......................... 13 1.1.3 Projectionmaps........................ 13 1.2Photontracing............................ 14 1.2.1 Reflection,transmission,orabsorption?........... 15 1.2.2 WhyRussianroulette?.................... 17 1.3Photonstoring............................ 17 1.3.1 Whichphoton-surfaceinteractionsarestored?....... 17 1.3.2 Datastructure........................ 18 1.4Extensiontoparticipatingmedia.................. 20 1.4.1 Photonemission,tracing,andstorage............ 20 1.4.2 Multiple scattering, anisotropic scattering, and non-homo- geneousmedia......................... 20 1.5Threephotonmaps.......................... 21 2 Preparing the photon map for rendering 22 2.1Thebalancedkd-tree......................... 23 2.2Balancing............................... 23 3 The radiance estimate 24 3.1Radianceestimateatasurface.................... 24 3.2Filtering................................ 28 3.2.1 Theconefilter......................... 28 3.2.2 TheGaussianfilter...................... 29 3.2.3 Differentialchecking..................... 29 3.3Theradianceestimateinaparticipatingmedium......... 30 3.4Locatingthenearestphotons.................... 30 4 Rendering 33 4.1 Direct illumination .......................... 35 4.2Specularandglossyreflection.................... 36 4.3Caustics................................ 37 4.4Multiplediffusereflections...................... 38 4.5Participatingmedia.......................... 39 4.6Whydistributionraytracing?.................... 39 5 Examples 40 5.1TheCornellbox............................ 40 5.1.1 Raytracing.......................... 40 5.1.2 Raytracingwithsoftshadows................ 40 5.1.3 Addingcaustics........................ 42 5.1.4 Global illumination ...................... 43 5.1.5 Theradianceestimatefromtheglobalphotonmap.... 43 5.1.6 Fast global illumination estimate .............. 45 5.2Cornellboxwithwater........................ 46 5.3FractalCornellbox.......................... 47 5.4Cornellboxwithmultiplelights................... 48 5.5Cornellboxwithsmoke........................ 49 5.6Cognacglass.............................. 50 5.7Prismwithdispersion......................... 51 5.8 Subsurface scattering ......................... 52 Slides illustrating the photon map algorithm 67 6 Foreword Welcome to this Siggraph course on photon maps! If you find this course material exciting, we encourage you to visit the following web-site where we will add new information based on the course: http://www.gk.dtu.dk/photonmap/ The inspiration behind this course is Alan Chalmers. Without his suggestion (over a beer) this course might never have materialized. Thanks, Alan! Thanks to Per Christensen for moral support and for writing parts of the chapter on photon tracing. In addition, thanks to Martin Blais, Byong Mok Oh, Gernot Schaufler and Maryann Simmons for helpful comments on the notes. Finally, we would like to thank intellectual property counsel Karen Hersey at Massachusetts Institute of Technology. 7 Introduction This course material describes in detail the practical aspects of the photon map algorithm. The text is based on previously published papers, technical re- ports and dissertations (in particular [Jensen96c]). It also reflects the experience obtained with the implementation of the photon map as it was developed at the Technical University of Denmark. After reading this course material, it should be relatively straightforward to add an efficient implementation of the photon map algorithm to any ray tracer. 0.1 Motivation The photon map method is an extension of ray tracing. In 1989, Andrew Glassner wrote about ray tracing [Glassner89]: “Today ray tracing is one of the most popular and powerful tech- niques in the image synthesis repertoire: it is simple, elegant, and eas- ily implemented. [However] there are some aspects of the real world that ray tracing doesn’t handle very well (or at all!) as of this writ- ing. Perhaps the most important omissions are diffuse inter-reflections (e.g. the ‘bleeding’ of colored light from a dull red file cabinet onto a white carpet, giving the carpet a pink tint), and caustics (focused light, like the shimmering waves at the bottom of a swimming pool).” At the time of the development of the photon map algorithm in 1993, these problems were still not addressed efficiently by any ray tracing algorithm. The photon map method offers a solution to both problems. Diffuse interreflections and caustics are both indirect illumination of diffuse