A Realistic, Generic Earth/Atmosphere Model - CS348B Final Project
Author
Dick Brouwer
Final Image
8.00am. Images with different sun positions can be found at the bottom of this write-up.
Overview
Rendering scenes, especially outdoors, generally involves using manually created environment maps to realistically render skylight. Especially for twilight scenes with very diverse lightning conditions no suitable tools are readily available. I want to create a generic model for rendering a realistic sky for a given position on the earth, season, time of day and atmosphere condition (e.g. foggy, polluted etc.) to replace outdoors environment maps. My model should therefore not be too computational intensive.
To accurately render skylights many atmospheric effects have to be taken into account, including:
- Solar irradiance spectrum and its absorption in the ozone layer
- Wavelength-dependent refraction of direct sunlight in the atmosphere
- Climate-dependent composition and size distribution of aerosols / dust particles
- Height-dependent air, humidity, and aerosol density
- Rayleigh scattering (air molecules) and Mie scattering (aerosols)
- Radiative transfer (multiple scattering)
- Illumination of the atmosphere by the earth's surface (small, so neglected in my discussion)
Important papers related to these issues are: Physically Based Simulation of Twilight Phenomena, Realistic Solar Disc Rendering and A Practical Analytic Model for Daylight.
Example images of beautiful skylights are plentiful. Here are some examples of the images I would like to reproduce:
Techniques Used
1st Attempt: Divide the atmosphere in cells and layers
The most realistic way of rendering the sky is to divide the atmosphere into hundreds or thousands of different layers. Each layer is then split into different cells (see pictures). I started implementing this model but ran into some big issues:
- 1st Calculations took over 4 hours to render (small scenes). This was mainly due to multiple scattering from different cells. Potentials optimizations could be possible, but it is inherently a costly process.
- Required many rays to be send-out into the scene. Because of atmospheric refractions from each layer to the next, light rays with different wavelengths could have many different paths associated with them.
- Much atmospheric data is required per atmosphere layer. Temperature profile, scattering coefficients for different particle sizes (aerosols), air humidity etc. Although some of it is easily available from the web, this makes it harder to implement as a 'generic' model.
All three reasons make this model cumbersome and slow to implement and would not be a great tool as an environment map replacement.
2nd Attempt: Analytical approximations for skylight, sunlight and aerial perspective
I modeled the scene using three different techniques. A skylight (atmosphere) mimicked the colored background and provided illumination on the whole hemisphere on the scene. A directional sunlight was implemented to further illuminate the scene. Lastly, an implementation of aerial perspective rendered the blue-ish foggy effect that occurs when objects are far away and the sky is hazy.
Skylight
The literature mentioned above describes a parametric sky model that is developed by measuring different sky intensities and colors with different sun angles and atmospheric haze combinations. The resulting data is fitted to a model that is reasonably accurate in predicting the color of the sky. Esoteric sky conditions cannot be created but for 'standard' atmospheres this works well. Turbidity is a catch-all term to describe the amount of 'haze' in the sky - replacing detailed calculations for different scattering coefficients for particles in the sky (Rayleigh and Mie scattering). Although turbidity is a great simplification of the true nature of the atmosphere, it is a practical measure of great utility. Because it does not require complex instrumentation to estimate turbidity, it is particularly well-suited for this application. The figure below gives meteorological range Rm for various turbidity values. I implemented the skylight using a infinite area light in PBRT. I created a new spectrum model, colorspace conversion and tonemapping funtions to accurately render this area light. Both will be discussed later.
Sunlight
Sunlight is modeled using a direct lightsource in PBRT. The spectral radiance is looked-up in a table for different wavelengths. Next, the radiance is attenuated by different scattering and absorption parameters (both Rayleigh and Mie scattering are implemented). Both parameters are a function of wavelength (the sky is blue because amongst others the Rayleigh scattering function is proportional to 1/lambda4).
Aerial Perspective
Approach
Step 1: Sun/Earth Positioning
As a first step I need to model the sun's position relative to the earth given certain input parameters. Because this calculation does not need to be dead-on accurate I can make some simplifying assumptions like using a spherical earth. This should make these calculations fairly straighforward. My input parameters would be: "Time-of-day", "Position on Earth (latitude/longitude)" and "Day-of-year (seasonal dependence)".
Next to calculating the position of the sun I need to collect data on atmospheric conditions. Some I will asume fixed (e.g. athmosphere temperature layers etc.) and others will be parameterized like humidity and aerosol distribution.
Step 2: Atmosphere Modeling
to realistically render the sky I need to calculate direct and indirect illumination of the whole atmosphere. A schematic description of the earth is depicted below:
Some different effects I will have to consider are:
- Absorption in the Ozone layer
- Atmospheric Refraction (wavelenght dependent)
- Scattering (both Rayleigh scattering caused by air molucules and Mie scattering caused by aerosol particles)
- Radiative Tranfer (the 'global illumination' in the atmoshpere)
- Reflection from light on the earth's surface up into the sky (probably negligible)
Step 3: Creating Sky Environment Map
Because of the computational intensity of the above-described processes I could potentially output the skylight in an HDRI environment map for re-usage. PBRT can automatically plug-in this environment map in it's calculation and speed-up multiple renderings using the same skylight.
Project Viability
I am currently researching the extend to which I can make this model 100% physcically accurate given the complex nature of the sky. I might have to use several approximations to speed-up the rendering process and the model the atmosphere. This general model could be re-used and expanded in subsequent research however and will definately get the 'basics' of skylight rendering right.