lucille: Open Source Global Illumination Renderer - Semantic Scholar

7 downloads 1216 Views 4MB Size Report
email: [email protected] ... Software renderers whose source code is also distributed for educational or ..... [7] http://radsite.lbl.gov/radiance/HOME.html.
lucille: Open Source Global Illumination Renderer http://lucille.sourceforge.net Masahiro Fujita Keio University Graduate School of Media and Governance email: [email protected]

Takashi Kanai Keio University Faculty of Environmental Information email: [email protected]

ABSTRACT

2 Background

This paper introduces a multi-platform and open source global illumination renderer called lucille. lucille implements recent global illumination algorithms such as Monte Carlo ray tracing, and photon mapping. It also includes a lot of functionality, for example, various BRDF models, HDRI lighting, parallel rendering, SIMDoptimized ray tracing, and so on. lucille inputs the scene data in the RIB format which is standard in the computer graphics community.

Software renderers whose source code is also distributed for educational or verificational purpose are available. RenderPark is an open source renderer developed by Katholieke Universiteit Leuven, Belgium for the purpose of examinations in global illumination algorithm [6]. However, the development of RenderPark has been stopped at the moment. lrt (literate ray tracer) is an educational ray tracing software by Mat Pharr. It implements a general global illumination algorithm such as photon mapping or path tracing. Although lrt is used for the lecture of Computer Graphics at Stanford University, it is not released for the public. Radiance is a global illumination renderer based on Monte Carlo ray tracing which enables an exact light transport simulation [7]. Radiance is developed and supported by Lawrence Berkeley National Laboratory in University of California. However, recent global illumination algorithms such as photon mapping are not implemented in this software.

KEY WORDS global illumination, Monte Carlo ray tracing, photon mapping, BRDF, SIMD

1 Introduction lucille is a software renderer which implements various global illumination algorithms. Recently, research about global illumination and related topics have been increasing in the field of 3D computer graphics. Especially, a lot of algorithms for interactive or real-time graphics using graphics hardware can be found in [1, 2, 3, 4, 5]. However, most research about interactive rendering of global illumination require reference software implementation to compare the results. In addition, pre-computation by a software renderer may also be required [1, 2]. To research about interactive algorithms of global illumination, it is required not only to implement a rendering engine using graphics hardware, but also a software renderer as a reference. A global illumination algorithm is rather complicated compared to scan line or ray tracing algorithm. Hence it requires a huge amount of work to implement both interactive algorithm using graphics hardware and its software reference renderer. Since lucille implements a standard global illumination algorithm, it reduces researcher’s troublesome work for coding software renderer by themselves. Actually, it is better to use lucille as a reference for researchers and students when coding global illumination algorithms.

3 Features and Functionality of lucille lucille is written in C language, not in C++. The reason is that it is easier to understand C code, and that it has less dependency on the relations between different functionality of codes than C++. Hence it is also easy to cut out a part of codes and re-use them. lucille has the following features and functionality: • Monte Carlo ray tracing • Spatial data structure and primitives • RIB file format input • Photon Mapping • HDRI lighting • Various type of BRDF models • Parallel rendering (based on MPI) • SIMD-optimized ray tracing

• Cross platform We will describe the details of these features and functionality as follows. Monte Carlo ray tracing lucille adopts a distributed ray tracing based on Monte Carlo method as the core of the light transport algorithm. In Monte Carlo ray tracing, when a ray launched from the viewport (primary ray) hits a surface, secondary rays are shot from the intersection point to random direction. The random directions are constraint to be within the hemisphere defined by the surface normal. In addition, the direction of reflection when a ray hits a surface is determined randomly by Monte Carlo method. We use Mersenne Twister [8] random number generator for that purpose. Monte Carlo method is an iterative approach. Unfortunately, this method requires many iterations to reduce the noise to an acceptable level. In the near future, we will use a quasi Monte Carlo method that has less noise thanks to a rapid iteration. Spatial data structure and primitives lucille treats only triangles as geometry primitives. This is because other representations such as non-triangle polygons or parametric surfaces can be converted into triangular meshes. Furthermore, a ray tracing engine is more compact by treating only triangles. lucille adopts a simple uniform grid as spatial data structure which can be easily implemented for the fast processing of ray-triangle intersection detection. RIB file format input lucille adopts RIB (RenderMan Interface Bytestream) format which is one of standard scene description languages in Computer Graphics production community. RIB format is open and its specification is widely released to the public [9]. Major commercial software such as Maya or 3D Studio Max has a plug-in for the output in RIB format. Photon mapping lucille implements photon mapping [10] which is a recent global indirect illumination method. Using photon mapping techniques, the lights sources release energy unit (photon) instead of rays. The resulting algorithm is faster and more accurate than ray tracing. It enables an efficient rendering of caustics which is difficult to represent by Monte Carlo ray tracing. Furthermore, photon mapping reduces the number of rays while it is exponentially increased in the case of Monte Carlo ray tracing. HDRI lighting lucille implements HDRI (High Dynamic Range Image) lighting. In a standard image each RGB value is represented by 8 bits in the range of [0, 255]. However, it is insufficient to represent colors and lights of the actual world. In HDRI, each of RGB values is represented

by a floating point value. This enables to have high dynamic ranges of the actual world. It is possible to compute an image-based lighting [11] by using HDRI as environment mapping and by regarding each pixel of HDRI as a light source. It is also possible to physically simulate lighting effects of the actual world by capturing HDRI. Actually, lucille implements the following four algorithms for HDRI lighting: • Stratified sampling This sampling strategy generates uniform random points on an unit sphere, and samples a lighting value in the direction for each of sampled points. This strategy is inefficient for HDRI that has great variation of lighting values. In most of cases, high-frequency noises appear in the rendering results. • Importance sampling This sampling strategy first generates a histogram of lighting values from HDRI. In the sampling stage, a random number in the range from zero to the sum of lighting values is generated. A point is sampled to a pixel corresponding to such a random number from a histogram. • Stratified importance sampling This is almost the same as the importance sampling described above, the only difference is how to generate the random number in each stratification. That is, the interval from zero to the sum of lighting values is divided equally by the number of samples N . A random number is generated in each of divided intervals. • Structured importance sampling This sampling approach is proposed by Agarwal et al. [12]. Unlike in the above three approaches, it is a deterministic approach. It has less noise and is useful for animation. Figure 1 shows the rendering results by using HDRI. Various type of BRDF models There are mainly two issues in the rendering of global illumination. One is light transport, the other is behavior of reflection when a light ray hitting a surface. The behavior of reflection is generalized by BRDF (Bidirectional Reflectance Distribution Function). lucille implements various heuristic BRDF models. Figure 2 shows the rendering result depending on the BRDF model used. Parallel rendering The computation of global illumination is much slower than standard ray tracing. lucille implements parallel rendering using MPI (Message Passing Interface) to reduce rendering time. The current implementation adopts a simple parallel rendering approach: we assign a CPU for each node and the same scene data is used for all nodes. There are two sub-processes that have been

(a)

(b)

(c)

(d)

Figure 1. The rendering results using various methods for HDRI lighting. In each figure, a light source is placed at the upper right in front of a teapot. The bottom image in each figure is the magnification of the upper image. (a) Stratified sampling. One high noise appears. (b) Importance sampling. Shadows of the handle strongly appear due to aggregate samples around the highlighted region. Also, there are noises in the boundary of shadows. (c) Stratified importance sampling. Shadows of the handle is softer, however, noises still appear. (d) Structured importance sampling. Shadows of a handle are soft and there is no noise because of the deterministic approach. The number of sampling points in each image is 300.

(a)

(b)

(c)

(d)

Figure 2. The images rendered by different BRDF models in the same lighting environments. (a) Lambert BRDF model. (b) Modified Phong BRDF model. (c) Anisotropic Ward BRDF model. It has the characteristic that a crescent-shaped highlight appears. (d) Anisotropic Ashikhmin-Shirley BRDF model. It has the characteristic that a circular highlight appears.

implemented using MPI. One is photon tracing in photon mapping, the other is ray tracing . hotons The photon tracing part thus requires only ( nP nN odes ) tracings, where nP hotons, nN odes denote the total number of photons and the number of nodes, respectively. A master node receives the results of tracing from all nodes and then photon map is constructed. A constructed photon map is broadcasted back to each node and is used in subsequent ray tracing part. Only the construction of photon map is difficult to execute in parallel. That is why a single node (master node) is recursively used for this. In the ray tracing part, each scan line of display is assigned to a node. Apparently, scanning a line which has more polygons takes more time. Here we implement a simple parallel algorithm: each scan line is assigned to a node when all nodes have finished processing previous load. SIMD-optimized ray tracing Most of recent CPUs equip SIMD-type vector processing units (for example, SSE in Pentium III or later, AltiVec in PowerPC G4 or

later). These units can process four floating point operations at a time. In global illumination algorithms, the most timeconsuming process is ray tracing. lucille is optimized so that intersection detections with four triangles are processed at a time in ray tracing. This optimization is especially effective in the case of complicated scenes. According to the measure of the computation time in the test scene shown in Figure 3, it can be found that SIMD-optimized ray tracing establishes 2.0-2.5 times reduction in the whole rendering process. Cross platform The source code of lucille is OSindependent. Furthermore, external libraries are not used. The supported platforms are: Microsoft Windows (cygwin, Visual C++), Linux (x86, PlayStation2), MacOS X, Sun Solaris (sparc), SGI IRIX. However, only Windows and X Window Systems are used because the frame buffer of rendering image is dependent on window systems.

plement an efficient code for parallel rendering which can schedule load balances. Finally, we would like lucille to be composed of two parts: the description of each global illumination algorithm along with its code as in “Numerical Recipes in C” [13].

Acknowledgement We would like to thank Mr. Alexandre Gouaillard for proofreading this paper. We also would like to thank Prof. Tomoshi Miyamura, Nihon University, for granting us the usage of 16× CPU parallel PC cluster.

References

Figure 3. A test scene composed of 70,000 polygons. The computation time is measured with a rendering window of 512×512 pixels, one ray per pixel and 32 reflection rays for each initial ray. It takes 76.3 sec. using non SIMD-optimized version, and only 32.4 sec. with SIMDoptimized version. (Pentium4 2.4GHz, WindowsXP, gcc compiler)

4 Sample Images Figure 4 demonstrates some of the scenes rendered by lucille. All scene data are generated from Maya.

5 Concluding Remarks We have described lucille: an open source global illumination renderer and the different algorithms included in detail. We have explained the interests of using lucille for researchers or students in the field of global illumination. It is our hope that it will be used a reference implementation by other researchers. On the other hand, we also think that lucille can be used by beginners or by people not interested in research. Because of this, we are also developing plug-in software to use lucille from standard commercial modeling software such as Maya. The web page of lucille is: http://lucille.sourceforge.net/ lucille is available from the above web page. The software is released under modified BSD license. lucille lacks a lot of functionality at the present moment. We will implement various rendering algorithms in the future. In addition, we will prepare several documents such as reference manuals and tutorials. We will also im-

[1] Peter-Pike Sloan, Jan Kautz, and John Snyder. Precomputed radiance transfer for real-time rendering in dynamic, low-frequency lighting environments. ACM Tranaction on Graphics (Proceedings of SIGGRAPH 2002), 21(3):527–536, 2002. [2] Ren Ng, Ravi Ramamoorthi, and Pat Hanrahan. Allfrequency shadows using non-linear wavelet lighting approximation. ACM Transactions on Graphics (Proceedings of SIGGRAPH 2003), 22(3):376–381, 2003. [3] Timothy J. Purcell, Craig Donner, Mike Cammarano, Henrik Wann Jensen, and Pat Hanrahan. Photon mapping on programmable graphics hardware. In Proceedings of the ACM SIGGRAPH/EUROGRAPHICS Conference on Graphics Hardware, pages 41–50. Eurographics Association, 2003. [4] Kirill Dmitriev, Stefan Brabec, Karol Myszkowski, and Hans-Peter Seidel. Interactive global illumination using selective photon tracing. In Proceedings of the 13th Eurographics Workshop on Rendering, pages 25–33. Eurographics Association, 2002. [5] Greg Coombe, Mark J. Harris, and Anselmo Lastra. Radiosity on graphics hardware. Technical Report TR03-020, Department of Computer Science, UNCChapel Hill, 2003. [6] http://www.renderpark.be/. [7] http://radsite.lbl.gov/radiance/HOME.html. [8] Makoto Matsumoto and Takuji Nishimura. Mersenne twister: A 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation, 8(1):3–30, 1998. [9] Pixar. Renderman interface specification, version 3.2, 2000. [10] Henrik Wann Jensen. Global illumination using photon maps. In Rendering Techniques ’96, Proceedings

of the Eurographics Workshop, pages 21–30. Eurographics Association, 1996. [11] Paul Debevec. Rendering synthetic objects into real scenes: Bridging traditional and image-based graphics with global illumination and high dynamic range photography. In Proceedings of ACM SIGGRAPH 98, pages 189–198. ACM Press, New York, 1998. [12] Sameer Agarwal, Ravi Ramamoorthi, Serge Belongie, and Henrik Wann Jensen. Structured importance sampling of environment maps. ACM Tranaction on Graphics (Proceedings of SIGGRAPH 2003), 22(3):605–612, 2003. [13] William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery. Numerical recipes in C. Cambridge University Press, Cambridge, UK, 2nd edition, 1992.

(a)

(b)

(c)

(d)

Figure 4. Sample images rendered by lucille. (a) Cornell box using photon mapping. (b) Sponza Atrium scene. Model data and texture data are freely destributed. These data are frequently used for the rendering tests of global illumination (Copyright is courtesy of Marko Dabrovic). (c) Teapots array scene composed of 2.1 million polygons. The rendering time is about four minutes (512×512 pixels) by a parallel PC cluster with 16× Intel Xeon 2.4GHz CPUs. (d) “lucy” model rendered with HDRI lighting. It is composed of 28 million polygons. The rendering time is two hours and 41 minutes (1024×1024 pixels) by the same parallel PC cluster. “lucy” model is courtesy of Stanford University, Computer Graphics Laboratory.

Suggest Documents