# Air

There are two basic choices to be made in the description of the atmosphere. First is the shape of the air. On the Earth, the air is actually a round shell surrounding the planet, however, in some cases, it can be much easier to deal with a flat atmosphere. RenderWorld lets you choose between these two types of air. `Flat` is computationally somewhat faster, but will produce incorrect results in certain circumstances, particularly sunsets and high altitude shots. Round air is slightly slower, but always produces the correct effects at the horizon.

The second option in the air is an air quality parameter. The simplest case is perfectly clean air with no haze-like particles present. This produces beautiful blue skies that become blue-white at the horizon. By choosing `dirty` rather than `clean` for `air_type`, you can add particles to the atmosphere. "Particles" refers to any microscope particle, whether it is bits of dust or water droplets. Thus we use "dirty" air for fog, haze, and smog.

The air is a volumetric structure contributing both attentuation and light. RenderWorld provides a second atmospheric structure, a skydome, for importing a sky of your choice while maintaining the volumetric character of the air. A skydome is an image of a sky mapped from a fish-eye lens. As described in detail below, the dome is modeled at being a shell at a particular altitude in the sky, and is translationally invariant.

### The Air File

Below are two examples of the air input file. First, the simplest case of a clean, flat atmosphere. As with the scene file, the first line of the air file identifies this as a RenderWorld air file with some version information. The next two lines have to do with defining color bands as discussed in the section on the scene file.

    RenderWorld_data_file air 1 1
           number_of_bands 3
           band_id 1 2 3
           file_type clean
           surface_type flat
           mol_height_scale 1.0
           mol_density_scale 1.0
           end

The next two lines choose a clean, flat atmosphere. There are two parameters to specify the size, opacity, and color of the air. `mol_height_scale` refers to how tall the atmosphere is, while `mol_density_scale` controls how dense it is. In both cases, a value of 1.0 represents the typical values for Earth at sea level. For producing realistic images, these values shouldn't be changed much if at all.

Choosing a round atmosphere rather than flat introduces one new parameter, the radius of the planet that the air surrounds. The value in the example file is the radius of the Earth in meters. This value can be changed, but note that the earth's radius is an input parameter to other files as well, and so it is important to coordinate the values used. The important thing is that the same radius be entered for the ocean's radius in the ocean file later.

           RenderWorld_data_file air 1 1
           number_of_bands 3
           band_id 1 2 3
           file_type dirty
           surface_type round
           radius 6371230
           mol_height_scale 1.0
           mol_density_scale 1.0
           dirty_height_scale 1.0
           dirty_density_scale 0.2
           dirty_factor 0.5
           sun_threshold 1000
           end

The second example uses the `dirty` air option. Dirty air introduces 3 other new parameters. Two (`dirty_height_scale`, and `dirty_density_scale`) are similar to the parameters for the clean air, affecting the height and density of the fog/smog. The guidelines for setting these parameters are that they should both be positive, and a value of much greater than 1 for the `dirty_density_scale` can result in near total blockage of the sun.

The parameter `dirty_factor` relates to the size distribution of the microscopic aerosol particles in the air. A value of 0.5 or less produces a more fog like image, while a value of 0.9 is more smog like. This value should be restricted to be between 0.1 and 1.0. Beyond that, its effects are best learned by experimenting.

For almost any atmosphere, the sun is going to be considerably brighter than any other objects in the scene. Thus, if the camera sees the sun directly, it will generally saturate in all three color bands and produce a white sun in the image. The final line in the air file allows us to solve this problem. By specifying a threshold value, RenderWorld will make sure than the sun's intensity doesn't exceed this value in any one of the bands, and will preserve the color of the sun. The value here is in scientific units, and the exact effect will depend upon the scaling chosen, so some experimentation may be required. Generally though, a value of 1000 works well. Note that this line is optional.

### The Skydome

A skydome is an image that is mapped onto an imaginary hemispherical shell in the atmosphere at a user-prescribed altitude. Except for its spherical nature and connection to the atmosphere/camera geometry, the skydome and its parameters behave very similar to the picture object. As with the air object, a skydome is placed in a scene file as follows:

    number_of_times 1
           time x  y  z theta phi chi
           0    0  0 -1 0     0   0
           name: skydomeabc
           type: skydome
           input: skydome.dat
           priority 0

The skydome file `skydome.dat` contains the following information:

           RenderWorld_data_file skydome 2 2
           radius 100000.
           number_of_bands 3
           band_id 0 1 2
           file_name jungle.rgb
           min_radiance 0. 0. 0.
           max_radiance 255. 255. 255.
           image_method 0
           end

This is similar to the picture file. The `radius` is the imagined altitude above the surface of the earth (in this example, 100 km). `file_name` gives the name of the sgi rgb file containing the skydome image. The 8-bit/color image is mapped in radiometric units by using the `min_radiance` and `max_radiance` lines. The `image_method` `0` renders the skydome and its reflections, whereas `image_method` `1` renders the skydome reflections but not the primary image of the skydome.

Note that to use the skydome, the version information at the top of the skydome file must be `2 2`.

The skydome image itself is a rectangular image which maps a spherical lens (Schwarzschild lens) onto a flat plane.

### Skydomes with Alpha Channels

Skydomes can use an alpha channel in the skydome image. The format for the skydome input file is:

           RenderWorld_data_file skydome 4 4
           radius 10000
           number_of_bands 3
           band_id 1 2 3
           file_name jungle.rgb
           horizon_angle 0.
           animate frames
           use_alpha 1
           min_radiance 0.   0.   0.
           max_radiance 255. 255. 255.
           image_method 0
           end

The additional lines have the following meaning:

The `horizon_angle` is the angle below the nominal end of the skydome (at theta=90 degrees) to extend the skydome.

The line beginning with `animate` determine whether the skydome images are animated. The options are `no` and `frames`. When `frames` is chosen, RenderWorld tries to read the file `jungle.rgb.xxxx` for frame xxxx.

The alpha channel of the skydome is used when `use_alpha` has the value `1` or `2` (0 is the no alpha choice). For the value `1`, the background is attenuated by the alpha, and for the choice of `2`, the background is attenuated and the skydome texture is conditioned by the alpha.

Contents