Previous:Bitmap Modifiers Main Index Next:Media Types

## Media

The `media` statement is used to specify particulate matter suspended in a medium such air or water. It can be used to specify smoke, haze, fog, gas, fire, dust etc. Previous versions of POV-Ray had two incompatible systems for generating such effects. One was `halo` for effects enclosed in a transparent or semi-transparent object. The other was `atmosphere` for effects that permeated the entire scene. This duplication of systems was complex and unnecessary. Both `halo` and `atmosphere` have been eliminated. See "Why are Interior and Media Necessary?" for further details on this change. See "Object Media" for details on how to use `media` with objects. See "Atmospheric Media" for details on using `media` for atmospheric effects outside of objects. This section and the sub-sections which follow explains the details of the various `media` options which are useful for either object media or atmospheric media.

Media works by sampling the density of particles at some specified number of points along the ray's path. Sub-samples are also taken until the results reach a specified confidence level. When used in an object's `interior` statement, sampling only occurs inside the object. When used for atmospheric media, the samples run from the camera location until the ray strikes an object. Therefore for localized effects, it is best to use an enclosing object even though the density pattern might only produce results in a small area whether the media was enclosed or not.

The complete syntax for a `media` statement is as follows:

MEDIA:

`
  media {
` [MEDIA_IDENTIFIER] [MEDIA_ITEMS...] `}`
MEDIA_ITEMS:
`
  intervals
` Number | `samples` Min`,` Max | `
  confidence
` Value | `variance` Value | `ratio` Value | `
  absorption
` COLOR | `emission` COLOR | `
  scattering {
` Type`,` COLOR [ `eccentricity` Value ] [ `extinction` Value ] `}` | `
  density {
` [DENSITY_IDENTIFIER] [PATTERN_TYPE] [DENSITY_MODIFIER...] `}` |
  TRANSFORMATIONS
DENSITY_MODIFIER:
  PATTERN_MODIFIER
| DENSITY_LIST | COLOR_LIST | `
  color_map{
` COLOR_MAP_BODY `}` | `colour_map{` COLOR_MAP_BODY `}` | `
  density_map{
` DENSITY_MAP_BODY `}`

If a media identifier is specified, it must be the first item. All other media items may be specified in any order. All are optional. You may have multiple `density` statements in a single `media` statement. See "Multiple Density vs. Multiple Media" for details. Transformations apply only the `density` statements which have been already specified. Any `density` after a transformation is not affected. If the `media` has no `density` statements and none was specified in any media identifier, then the transformation has no effect. All other media items except for `density` and transformations override default values or any previously set values for this `media` statement.

Note that some media effects depend upon light sources. However the participation of a light source depends upon the `media_interaction` and `media_attenuation` keywords. See "Atmospheric Media Interaction" and "Atmospheric Attenuation" for details.

Note a strange design side-effect was discovered during testing and it was too difficult to fix. If the enclosing object uses `transmit` rather than `filter` for transparency, then the `media` casts no shadows. For example:

     object{MyObject pigment{rgbt 1.0} interior{media{MyMedia}}} //no shadows

     object{MyObject pigment{rgbf 1.0} interior{media{MyMedia}}} //shadows

Previous:Bitmap Modifiers Main Index Next:Media Types