Difference between revisions of "Reference:Media"

From POV-Wiki
Jump to navigation Jump to search
m (moved sub-sections to individual files)
m (technical correction)
 
(One intermediate revision by the same user not shown)
Line 45: Line 45:
 
method      : 3
 
method      : 3
 
ratio        : 0.9
 
ratio        : 0.9
samples      : Min 1, Max 1
+
samples      : 10
 
variance    : 1/128
 
variance    : 1/128
 
SCATTERING
 
SCATTERING
Line 53: Line 53:
 
</pre>
 
</pre>
  
<p>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 <code>density</code> statements in a single <code>media</code> statement. See [[Reference:Media#Multiple Density vs. Multiple Media|Multiple Density vs. Multiple Media]] for details. Transformations apply only to the <code>density</code> statements which have been already specified. Any <code>density</code> after a transformation is not affected. If the <code>media</code> has no <code>density</code> statements and none was specified in any media identifier, then the transformation has no effect. All other media items except for <code>density</code> and transformations override default values or any previously set values for this <code>media</code> statement.</p>
+
<p>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 <code>density</code> statements in a single <code>media</code> statement. See [[Reference:Density#Multiple Density vs. Multiple Media|Multiple Density vs. Multiple Media]] for details. Transformations apply only to the <code>density</code> statements which have been already specified. Any <code>density</code> after a transformation is not affected. If the <code>media</code> has no <code>density</code> statements and none was specified in any media identifier, then the transformation has no effect. All other media items except for <code>density</code> and transformations override default values or any previously set values for this <code>media</code> statement.</p>
  
 
<p class="Note"><strong>Note:</strong> Some media effects depend upon light sources. However the participation of a light source depends upon the <code>media_interaction</code> and <code>media_attenuation</code> keywords. See [[Reference:Light Source#Atmospheric Media Interaction|Atmospheric Media Interaction]] and [[Reference:Light Source#Atmospheric Attenuation|Atmospheric Attenuation]] for details.</p>
 
<p class="Note"><strong>Note:</strong> Some media effects depend upon light sources. However the participation of a light source depends upon the <code>media_interaction</code> and <code>media_attenuation</code> keywords. See [[Reference:Light Source#Atmospheric Media Interaction|Atmospheric Media Interaction]] and [[Reference:Light Source#Atmospheric Attenuation|Atmospheric Attenuation]] for details.</p>
  
 
<p class="Note"><strong>Note:</strong> If you specify <code>[[Reference:Color Expressions#Color Keywords|:transmit|transmit]]</code> or <code>[[Reference:Color Expressions#Color Keywords|:filter|filter]]</code> to create a transparent container object, <code>absorption</code> media will always cast a shadow. The same applies to <code>scattering</code> media unless <code>extinction</code> is set to zero, so if a shadow is not desired, use the <code>no_shadow</code> keyword for the container object. This does not apply to <code>emission</code> media as it never casts a shadow.</p>
 
<p class="Note"><strong>Note:</strong> If you specify <code>[[Reference:Color Expressions#Color Keywords|:transmit|transmit]]</code> or <code>[[Reference:Color Expressions#Color Keywords|:filter|filter]]</code> to create a transparent container object, <code>absorption</code> media will always cast a shadow. The same applies to <code>scattering</code> media unless <code>extinction</code> is set to zero, so if a shadow is not desired, use the <code>no_shadow</code> keyword for the container object. This does not apply to <code>emission</code> media as it never casts a shadow.</p>

Latest revision as of 15:36, 12 February 2021

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 permeate 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. POV-Ray provides three methods of sampling. 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:
  method Number | intervals Number | samples Min, Max |
  confidence Value  | variance Value | ratio Value | jitter Value
  absorption COLOR | emission COLOR | aa_threshold Value |
  aa_level Value | 
  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 }

Media default values:

aa_level     : 3
aa_threshold : 0.1
absorption   : <0,0,0>
confidence   : 0.9
emission     : <0,0,0>
intervals    : 1
jitter       : 0.0
method       : 3
ratio        : 0.9
samples      : 10
variance     : 1/128
SCATTERING
COLOR        : <0,0,0>
eccentricity : 0.0
extinction   : 1.0

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 to 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: 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: If you specify transmit or filter to create a transparent container object, absorption media will always cast a shadow. The same applies to scattering media unless extinction is set to zero, so if a shadow is not desired, use the no_shadow keyword for the container object. This does not apply to emission media as it never casts a shadow.