# Clouds

Of the three types of volumetric material - clouds, sprays, and blobs - clouds are the simplest in terms of the number of parameters available. However, this does not usually reduce the difficulty for the user because the common method of creating clouds is by growing sprays and blobs into a desired volumetric distribution, then saving the result as a frozen distribution. Is is also possible to create cloud volumes in other software, writing a file with the proper format. This alternative is discussed at the end of this section.

Clouds are placed in a scene file with object`type:` `cloud`. The position and orientation given in the keytime data is for the geometric center of the bounding box in which the cloud is contained.

A typical input file containing cloud data is:

  `RenderWorld_data_file volume 1 1`
  `nx` `128`
  `ny` `128`
  `nz` `16`
  `dx` `2`
  `dy` `2`
  `dz` `1`
  `number_of_bands 3`
  `band_id 1 2 3`
  `absorption` `0.01 0.01 0.01`
  `scattering_coefficient` `.05 .05 .05`
  `extinction_coefficient` `.06 .06 .06`
  `phase_function_file` `phase_functions.dat`
  `density_threshold` `0.0`
  `scattering_flag` `multiple`
  `integration_step` `1.0`
  `transmission_cut` `0.00001`
  `integration_threshold` `0.0`
  `end`
  ``
  `RenderWorld_data_file cloud 1 1`
  `liquid_water_content binary` `cloudlwc.dat`
  `small_scale_fluctuation` `dynamic`
  `nx` `64`
  `ny` `64`
  `nz` `32`
  `scale` `0.125`
  `small_scale_file` `ss.dat`
  `generate_file` `yes`
  `fluctuation` `1.0`
  `power_law` `2.`
  `length` `1000.`
  `seed` `11011`
  `reference_time` `0.`
  `update_time` `0.25`
  `sigma` `0.5`
  `end`
  `end`

### Volumetric Parameters

The first part of this file, between `RenderWorld_data_file volume 1 1` and the first `end`, dictates the physical and optical properties common to all three volumetric objects: cloud, blobs, and spray. The volume is contained in a rectangular box which is divided into rectangular cells. The number of cells in each direction is `nx`, `ny`, and `nz`. Each rectangular cell has physical dimensions `dx`, `dy`, and `dz` in units of meters.

The optical behavior of the volumetric object is governed primarily by the three parameters absorption, scattering_coefficient, and extinction_coefficient. These parameters control the attenuation of sunlight and diffuse light, and the scattering of light within the volume toward the camera. Raising the absorption coefficent increases the opacity of the cloud, raising the extinction coefficienct increases the strength of the shadows in the cloud, and raising the scattering coefficient increases the overall brightness of the cloud. The other quantity affecting the scattered light is the phase function, which is contained in a separate file and designated by the line `phase_function_file phase_functions.dat` . The phase function determines the amount of light scattered by a piece of cloud material in each possible direction. It is a color-dependent quantity, and is responsible for producing optical effects like rainbows and glories. Different types of clouds can have different phase functions. The file `phase_functions.dat` is a text file with the phase function for each color. Editing the values in it will alter the scattering behavior and can lead to exotic effects.

The `density_threshold` parameter acts at rendering time to reduce any cloud density value less than this threshold to the value zero. Cells with zero density are transparent and do not scatter light.

Physically, clouds can scatter light many times (hundreds!) before the light reaches the camera. The line `scattering_flag` `multiple` provides a simple model of these many scattering events. The alternative choice that can be made is `scattering_flag` `single` uses a simpler single scattering event model.

The final three volumetric parameters provide the ability to trade between rendering time and image numerical accuracy. In all three cases, increasing the numerical value of the parameter shortens rendering time and increases the likelihood of having numerical artifacts. Each of these parameters controls the accuracy of numerical integrations that are conducted through the volume of the cloud.

The first parameter, `integration_step`, allows you to control the fineness with which numerical integrations are carried out in the rendering. The value of `integration_step` is in units of the cell size.

The second rendering parameter, `transmission_cut`, is concerns the fact that the numerical integrations in the rendering include the transmission through the cloud. This threshold parameter stops the integration when the transmission reduces to this value.

The last of these parameters, the values of the integrated quantities are example throughout the cloud volume. Using `integration_threshold`, regions in which the integration quantities are relatively small are excluded from the numerical integration.

### Cloud Parameters

The second half of the cloud input file contains parameters that are specific to the cloud rendering problem. The cloud is a fixed distribution of density (called liquid water content), which is read from a pre-existing file specified in the line for `liquid_water_content` . The term `binary` is necessary but there are no other options for it. The pre-existing file is the output of the blob and spray evolutions. Thus, even for a static cloud that is custom built uses the spray and/or blob to grow the cloud density distribution. See those sections for more details on sprays and blobs.

The cloud density is a fixed spatial distribution of cloud material, which because of RAM or computational limitations in running sprays and blobs, may not be large enough in terms of total extent compared to fine structure to meet various needs. One approach to solving this problem is to think of the cloud density as the larger scales of cloud structure, with smaller fine detail that is generated during rendering time. If no small-scale structure is needed, then the parameter `small_scale_fluctuation` should be set to `no`, and all of the subsequent lines through the first `end` eliminated.

When small-scale structure is desired, there are two types to choose from `small_scale_fluctuation` `dynamic` generates small-scale structure that changes in time, and `small_scale_fluctuation` `yes` generates small-scales that do not change in time. The example at the top of this section is for the first case, and will be used to describe how small-scale fluctuations are applied. The second case is presented at the end.

When small-scale fluctuations are desired, an additional 3D box is created to hold the fluctuations. The number of cells in each direction of this box is given by the `nx`, `ny,` and `nz` after the `small_scale_fluctuation` line. The physical size of the small-scale cells is equal to `scale` times the cell size of the cloud density. The small-scale fluctuations act as a multiplicative change in the density, and are periodically replicated throughout the cloud volume. Once generated, the small-scale fluctuations can be saved in the file `small_scale_file,` or read back in from the file by specifying `generate_file` `no` .

The positive-valued parameter `fluctuation` controls the magnitude of the fluctuations. Since the fluctuations are log-normal, a value above approximately 0.6 can break up a dense cloud into a sequence of apparently separate smaller clouds with the volume.

Although the fluctuations are random (the random number series is based on the `seed` parameter), they are correlated in space and time. The `power_law` controls the rate of fall-off of the correlation with distance (similar to a fractal dimension), and the `length` is the largest spatial length scale of fluctuations.

The `reference_time` is the physical time corresponding to the first generated volume of random fluctuations. As a simulation proceeds over time, the fluctuations are changed periodically at `update_time` intervals. The parameter `sigma` controls the rate at which the correlations in the fluctuations decay over time. Larger values of `sigma` cause the fluctuations to vary rapidly.

For small-scale fluctuations that do not need to evolve over time, the cloud-specific portion of the cloud file is shown below:

  `small_scale_fluctuation` `yes`
  `nx` `64`
  `ny` `64`
  `nz` `32`
  `scale` `0.125`
  `small_scale_file` `ss.dat`
  `generate_file` `yes`
  `fluctuation` `1.0`
  `length` `1000.`
  `seed` `11011`
  `end`

The parameters here have the same meaning as for the dynamic fluctuations.

Contents