Please log in first.

    NicolasBenitez/FinalProject

Final Project

Group Members

Nicolas Benitez

Michael Graeb

Goal

The goal of our project was to render a convincing image of the sky. More specifically, we were interested in modeling the sky such that the result:

1) Had convincing coloration

2) Provided appropriate lighting for the other elements in the scene

3) Contained realistic clouds

The image that we used as a reference to try to create these effects was the following image of the New York city skyline, taken from http://wwp.new-york-usa.com/:

Sky Simulation

Nico was responsible for simulating the color and exitant radiance of the sky. To do so, he implemented a new type of light source as a pbrt plugin. We made several attempts at modeling the sky before settling on the current system.

The first version of our sky model was based on A Practical Analytic Model for Daylight by Preetham et al. In the paper, Preetham describes a method for rendering skies based on Perez's phenomenological model for sky color. Perez defines a function based on five parameters that determine the shape and intensity of the sky gradient. Preetham used data from an intricate simulation of the sky and attempted to fit the five parameters to this data.

We implemented this model, but found the results to be insufficient for our purposes. The main problem that we encountered with this model was that it was very difficult to "tweak" the colorization of the sky, since it depended only on solar angle and a variable called "turbidity," which is similar to visibility. In order to better capture the color of the original image, we decided to attempt a more physically-based model.

(an example of a sky rendered using our implementation of Preetham's model).

The model that we ended up using was mainly inspired by two papers: Modeling and Rendering of the Atmosphere Using Mie-Scattering by D. Jackel and B. Walter, and Display Method of the Sky Color Taking into Account Multiple Scattering, by T. Nishita.

According to both papers, the spectral properties of the atmosphere are well-described by Mie Theory, which uses Maxwell's equations to describe the interaction of light with small spherical particles. Mie's general theory is very complicated and computationally intense. However, for small particles, Mie scattering reduces to an approximation called Rayleigh scattering, which explains phenomena such as the blue appearance of the daytime sky and red sunsets due to its highly wavelength-dependent scattering coefficient.

(An early render of the sky using only Rayleigh scattering. The left image is at sunset and the right is at midday.)

To try to make our system as flexible as possible, we modeled the sky as a set of an arbitrary number of different types of particles. This idea is similar to Walter's model, which used a set of concentric spheres to define areas of different optical properties. Each type of particle may define its own phase function, scattering coefficient, extinction coefficient (which is the same as the scattering coefficient for most atmospheric particles), and density distribution. Our final model used two types of particles: small particles, which we approximated using Rayleigh scattering, and larger particles such as aerosols and soot, which we modeled with a highly forward-scattering phase function that was not very wavelength-dependent. Both types of particles fall off exponentially in density as height increases.

To improve the accuracy of our final image, we extended pbrt's Spectrum class so that it stored the energy at several sampled wavelengths between 360 and 830 nm instead of just storing RGB color components. all of the computation of sky radiance is done using this enhanced version. Before passing the final value back to pbrt, we convert our our sampled energy values to CIE XYZ coordinates using the color matching functions provided by pbrt, and return the result as a pbrt Spectrum object. To approximate the spectrum of the sun before reaching the atmosphere, we modeled the sun using Planck's law which is described in the wikipedia entry: http://en.wikipedia.org/wiki/Planck%27s_law.

To actually render the scene, we approximated the sun as a directional light with parallel rays. We computed the radiance coming from the sky along a ray in a way similar to the single-scattering volume integrator provided by pbrt (this method is described similarly in both papers as well). We took a fixed number of samples along the ray starting at the viewer and moving towards the outer edge of the atmosphere. At each step, we multiplied the radiance of the sun by the product of the phase function and scattering coefficient (together called the volume phase function). The result was then multiplied by the optical depth to the viewer (which is computed incrementally at each step) and the optical depth to the sun from the current position along the ray. Because we did not implement multiple scattering, we had to multiply both our optical depth values by a correction factor so that the sky did not appear too dark.

Once we had implemented the basic functionality of our sky light source, we attempted to find real-world data to refine our model. The OPAC (Optical Properties of Aerosols and Clouds) software package is a tool for accessing the optical properties of particles in the Earth's atmosphere. OPAC is capable of outputting the extinction coefficient, scattering coefficient, and sampled phase function for various realistic mixtures of atmospheric particles. We wrote a class to parse this data and apply it to our own model, however, because the atmosphere is modeled in four discrete layers in OPAC, the resulting images had undesirable visual artifacts at the boundaries between layers. That said, given more time it would be interesting to work more on incorporating this data, since it is such a valuable resource for anyone attempting to simulate the sky. In the end, our method fell somewhere between the two extremes of a phenomenological model and a completely physically accurate model - we modeled a rough approximation to the real physics, but based much of our parameters on pure aesthetics to come up with the best image.

Cloud Modeling

The clouds were modeled using a technique described in Texturing & Modeling: A Procedural Approach. The clouds are initially described as implicit surfaces, using metaballs. Areas near the center of the volume described by the surface are most dense, with a smooth exponential falloff in density as the edge of the volume is approached. The use of metaballs, rather than a fluid simulation, to define the volume, allows a great deal of artistic control over the placement and approximate shape of the clouds.

The density values throughout the cloud are precomputed and stored within a a volume grid. To construct the grid, a walk is performed through each cell in the grid. At each cell, a lookup is performed into the metaballs and the density at this point is calculated. Without any additional modifications, the clouds look like a "globby clump" rather than the regularly perturbed, fluffy, structures that one expects. To achieve this effect, the lookup location is altered by a lookup into a low resolution noise grid, which is treated as turbulence, and regularly perturbs the lookup location. Additional noise is used to achieve further irregularity and a natural visual appearance.

The clouds are processed with a separate program and their densities stored as text files. This avoids the time consuming process of recalculating the clouds' densities for each render.

Cloud Lighting Simulation

Handling light's passage through the clouds proved difficult. Clouds are composed primarily of water molecules, which cause light to bounce a high number of times, with little absorption, before exiting the cloud. Light is ultimately diffused quite thoroughly throughout a cloud's density. PBRT implements a single-scattering volume renderer, which does not approximate this effect well.

Light appears as if it is scattered away completely in its path through the cloud, without properly accounting for all light scattered into the same ray. To prevent volume renders from appearing overly dark, pbrt allows for volumes with an "emissive" component which allows the clouds to give the illusion of highly scattered light by essentially lighting themselves internally.

We modified pbrt to model the physical scattering of light by allowing light rays to perform additional bounces in their march through the volume. The user specifies the number of bounces to take at each scatter and the maximum number of scatters before finally tracing a ray directly to a light source. We realized this technique was computationally intense, but hoped we could achieve a decent picture through careful optimizations.

Scattering

Initial:

1

1

1

30

Secondary:

1

1

2

Tertiary:

1

The desired effect of light scattering further into the cloud is achieved through additional scattering, but at a significant cost in render time and a great deal of noise. Another approach would be needed if a quality render of any significant size was to be produced within a reasonable time. We wished to compute scattering as a pre-process, as described in Display Method of the Sky Color Taking into Account Multiple Scattering but did not have enough time remaining. We found that we could achieve an effect close to our goals by utilizing the emissive component, along with careful tweaking of the volume's other properties.

Conclusion

1920x1200

Source

References

D. Ebert, F. Musgrave, D. Peachey, K. Perlin, S. Worley, "Texturing & Modeling: A Procedural Approach," Morgan Kaufmann, Third Edition, December 2002.

M. Hess, P. Koepke, I. Schult, “Optical properties of aerosols and clouds: The software package OPAC,” Bull. Amer. Meteorol. Soc., vol. 79, pp. 831-844, May 1998.

D Jackèl, B Walter (1997) Modeling and rendering of the atmosphere using Mie-scattering. Comput Graph Forum 16(4):201–210

T. Nishita, Y. Dobashi, K. Kaneda, H. Yamashita, "Display Method of the Sky Color Taking into Account Multiple Scattering," Proc. Pacific Graphics'96, 117-132, 1996.

T. Nishita, Y. Dobashi, E. Nakamae, "Display of clouds taking into account multiple anisotropic scattering and sky light," ACM SIGGRAPH, pp. 379 0 386, 1996.

A. J. Preetham, Peter Shirley, Brian Smits, A practical analytic model for daylight, Proceedings of the 26th annual conference on Computer graphics and interactive techniques, p.91-100, July 1999

Recent