next up previous contents
Next: 2.6 Photon Tracing in Up: 2. Physics Shaders Previous: 2.4 Photon Tracing

2.5 Participating Media

Fog, clouds, silty water, and similar media scatter some of the light that travels through it. In other words, these media participate in the light transport (see [Jensen 98]). A volume shader is needed to simulate participating media.

Volume Shader: parti_volume

The volume shader parti_volume can simulate homogeneous (uniform density) and nonhomogeneous participating media with isotropic (diffuse) or anisotropic scattering.  parti_volume and  parti_volume_photon use a two-lobed scattering model, which means that light scatters both forward and back in the incoming light direction. This scattering model is invented by Ch. Schlick and can model real scattering from dust, mist, rain-drops, etc.

Any medium (other than a vacuum) is assumed to contain suspended particles which scatter light traveling through it. Scattering plays an important role in the shading of volumes, and it is the size of the particles in relation to the wavelength of light which determines the type of scattering. If the particle radii are much smaller than the wavelength of light, there is no discernible scattering and the light is absorbed. Particles only slightly smaller than the wavelength of light produce what is known as Rayleigh scattering (cigarette smoke and dust). Particles roughly the same size as the wavelength of light give rise to Mie scattering (water droplets or fog). The Mie model can account for both sparse and dense partic le densities, referred to as Hazy Mie and Murky Mie respectively. When the particle size is much larger than the wavelength of light, geometric optics comes into effect (normal solid surfaces). Glassner suggests the following values:

function r g1 g2
Rayleigh 0.50 -0.46 0.46
Hazy Mie 0.12 -0.50 0.70
Murky Mie 0.19 -0.65 0.91

  

    color "parti_volume" (
            integer     "mode",
            color       "scatter",
            scalar      "extinction",
            scalar      "r",
            scalar      "g1",
            scalar      "g2",
            scalar      "nonuniform",
            scalar      "height",
            scalar      "min_step_len",
            scalar      "max_step_len",
            scalar      "light_dist",
            integer     "min_level",
            boolean     "no_globil_where_direct",
            array light "lights")

mode: in mode 0, the participating medium fills the entire volume. In mode 1, there is only participation medium below the given height, and there is clear air or vacuum above.

scatter is the color of the scattering medium. This determines the color of the light that is scattered by the medium.

extinction is the extinction coefficient of the medium. It determines how much light is absorbed or scattered in the medium. 0 means clear air or vacuum. The higher the coefficient, the denser the medium (and the more photon scattering).

r, g1, and g2 control scattering. If both g1 and g2 are zero (the default), isotropic scattering is modeled: all scattering directions have equal probability. This is sometimes also called diffuse scattering. Anisotropic reflection is modeled by a two-lobed scattering model. Each lobe can be either backscattering (-1 < g < 0), diffuse (isotropic, g = 0), or forward scattering (0 < g < 1). The first lobe is weighted by r, the second lobe by 1 - r.

nonuniform determines if the medium is homogeneous (uniform density) or nonhomogeneous (cloud-like density variation). It is a number between 0 and 1. A value of 0 makes the medium is completely homogeneous and depends only on the extinction parameter. A value of 1 creates a cloud-like Blinn density variation. Values between 0 and 1 give a mix between the two extremes.

height determines the height above which there is clear air or vacuum if the mode parameter is 1.

min_step_len and max_step_len are used to determine the step length for ray marching in a nonhomogeneous medium, or if the mode is 1.

light_dist is used for optimization of the sampling of area light sources. It is used if the area light source has the optional lower sampling, as in for example


    rectangle  0.5 0.0 0.0  0.0 0.0 0.5   10 10 3 2 2

For efficiency, parti_volume always uses the lower number of samples (here 2 2). This is usually sufficient since the direct illumination is computed at many points along each ray during ray marching. However, the higher number of samples (here 10 10) should be used near an area light source. The light_dist parameter determines how far away from a light source the higher number of samples have to be used.

min_level is ignored (it is used by the corresponding volume photon shader).

no_globil_where_direct is used for optimization. It can be set to true if the scene is such that there is no global illumination where there is direct illumination.

lights is an array of light instances.

Material Shader: transmat

This is a material shader for a helper surface of a participating medium. It simply traces a ray further in the direction it came from. Helper objects are used to enclose volume effects such as participating media implemented as volume shaders, without being visible themselves.

  

    color "transmat" ()

There are no parameters.


next up previous contents
Next: 2.6 Photon Tracing in Up: 2. Physics Shaders Previous: 2.4 Photon Tracing
Copyright 2002 by mental images