Previous:General Density Modifiers   Main Index   Next:Density Maps and Density Lists



Density with color_map

Typically a media uses just one constant color throughout. Even if you vary the density, it is usually just one color which is specified by the absorption, emission, or scattering keywords. However when using emission to simulate fire or explosions, the center of the flame (high density area) is typically brighter and white or yellow. The outer edge of the flame (less density) fades to orange, red, or in some cases deep blue. To model the density-dependent change in color which is visible, you may specify a color_map. The pattern function returns a value from 0.0 to 1.0 and the value is passed to the color map to compute what color or blend of colors is used. See "Color Maps" for details on how pattern values work with color_map. This resulting color is multiplied by the absorption, emission and scattering color. Currently there is no way to specify different color maps for each media type within the same media statement.

Consider this example:

  media{

    emission 0.75

    scattering {1, 0.5}

    density { spherical

      color_map{

        [0.0 rgb <0,0,0.5>]

        [0.5 rgb <0.8, 0.8, 0.4>]

        [1.0 rgb <1,1,1>]

      }

    }

  }

The color map ranges from white at density 1.0 to bright yellow at density 0.5 to deep blue at density 0. Assume we sample a point at density 0.5. The emission is 0.75*<0.8,0.8,0.4> or <0.6,0.6,0.3>. Similarly the scattering color is 0.5*<0.8,0.8,0.4> or <0.4,0.4,0.2>.

For block pattern types checker, hexagon, and brick you may specify a color list such as this:

  density{checker rgb<1,0,0>, rgb<0,0,0>}

See "Color List Pigments" which describes how pigment uses a color list. The same principles apply when using them with density.



Previous:General Density Modifiers   Main Index   Next:Density Maps and Density Lists