Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Design of the Interior of transparent Shapes in POV-Ray
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

  Content Overview
  material, interior, media

  - Syntax material
      texture + interior
  - Window Glass
      + max_trace_level
  - Fog, Mist or Haze
  Media
  - Syntax Media
  - Media+Density Maps
  Atmospheric Media
    with/without density map
  - Beames in the Fog
  Object Media
  Emitting Media
  - Light Sword
  - Candle Flames
  Scattering Media
  - Light through Window
  - Steam, Smoke, Clouds
  Absorbing Media
  - Dust Devils
  Special Problems with Media
  - Scaling of Media
  - Overlapping Media
                                             

"media" and "density maps"      

There are 4 pattern types which are of special interest with media density maps:
spherical
sphere{
    <0,0,0>, 1
    pigment{rgbt 1}
    hollow
 interior{ //-----------
 media{
  emission <1,1,1>
  scattering{1,<1,1,1>}
  density{ spherical
    turbulence 0
    color_map {
     [0 rgb 0.0]//border
     [1 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ---
 } // end of interior
 translate <0,1.00,0>
} //----- end of sphere
cylindrical
cylinder{
   <0,-0.5,01>,<0,1,0>,1
   pigment{rgbt 1}
   hollow
 interior{ //-----------
 media{
  emission<-.5,-.5,1>*.6
  scattering{1,<1,1,1>}
  density{ cylindrical
    turbulence 0
    color_map {
     [0 rgb 0.0]//border
     [1 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //---- end of cylinder
boxed
box{
    <-1,-.5,-1>,<1,1,1>
    pigment{rgbt 1}
    hollow
 interior{ //-----------
 media{
  emission<-.2,1,-.5>*.6
  scattering{1,<1,1,1>}
  density{ boxed
    turbulence 0
    color_map {
     [0 rgb 0.0]//border
     [1 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //------- end of box
planar
box{
    <-1,-.25,-1>,<1,1,1>
    pigment{rgbt 1}
    hollow
 interior{ //-----------
 media{
  emission<1,-.25,1>*.6
  scattering{1,<1,1,1>}
  density{ planar
    frequency 5
    color_map {
     [0 rgb 0.0]//border
     [1 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //------- end of box

We surely also can use all the other patterns and their modifiers, as known from textures., Here 3 other samples:
bozo
box{ <-1,-0.5,-1>,<1,1,1>
    pigment{ rgbt 1 }
    hollow
 interior{ //-----------
 media{
  emission <-0.4,0.7,1>*0.6
  scattering{ 1, <1,1,1>
              extinction  1.2 }
  density{ bozo
    turbulence 0
    frequency 20
    color_map {
     [0.0 rgb 0.0]//border
     [0.5 rgb 0.1]
     [1.0 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //------- end of box
gradient x
box{ <-1,-0.5,-1>,<1,1,1>
    pigment{ rgbt 1 }
    hollow
 interior{ //-----------
 media{
  emission <1,0.2,-0.6>*0.9
  scattering{ 1, <1,1,1>
              extinction  2.0 }
  density{ gradient x
    turbulence 0.5
    frequency 4
    color_map {
     [0.0 rgb 0.0]//border
     [0.5 rgb 0.1]
     [1.0 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //------- end of box
quilted
box{ <-1,-0.5,-1>,<1,1,1>
    pigment{ rgbt 1 }
    hollow
 interior{ //-----------
 media{
  emission <1,-0.8,-0.6>*1.0
  scattering{ 1, <1,1,1>
              extinction  2.5 }
  density{ quilted
    turbulence 0.0
    frequency 6
    color_map {
     [0.0 rgb 0.0]//border
     [0.5 rgb 0.1]
     [1.0 rgb 1.0]//center
     } // end color_map
   } // end of density
  } // end of media ----
 } // end of interior
 translate <0,1,0>
} //------- end of box

About Density Maps and Container Shapes .
If we use densities with turbulence it may be good to increase the container shape!

A sphere with radius 1.
Density map without turbulence.
 
A sphere with radius 1.
Density map with turbulence 1.3.
Container sphere clippes density!
A sphere with radius 1.5.
Density map with turbulence 1.3.
Density fits in container sphere !

We can also keep densities with turbulences inside of i.e. a sphere with smooth borders
by intersecting a density with another!

A sphere with radius 1.
Density map without turbulence.
 
A sphere with radius 1.5.
Density map with turbulence 1.3.
Container increased to fit density!
A sphere with radius 1.
Density map with turbulence 1.3
added unturbulated density map.
Smooth borders in container sphere!

Boolean operations with media and density maps
Its possible to use more than one density maps but also to use more than one media. The results are like in CSG with shapes.

intersection                       union                                      
 media{ ...
   density{ ... } //1
   density{ ... }//2
 } // end media


 
 media{ ...  //1
   density{ ... }
 } // end media 1
 media{ ...  //2
   density{ ... }
 }// end media 2
 
top
© Friedrich A. Lohmüller, 2009
www.f-lohmueller.de