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
|
Candle Flames by Emitting Media
Using "media emission" keyword
for the simulation of a burning candle's flame.
|
Candle flames by media emission.
|
|
With media emission we can simulate burning candle flames.
The container object we use (here: an egg shape) should be clear and made hollow
(allows media and for effects inside!).
The shape can be scaled together with the media to a candle flame shape.
Note: The color of the "emitted" Light is specified after the "emission" keyword.
But "media" not really "emit" light - it only means that it's visible without any extern illumination!
If we want the media shining with casting shadows etc., we have to put an additional light_source in the center!
// -----------------------------------------
#local Flame__Shape =
merge{ // egg
intersection{
sphere{<0,0,0>,1}
box{<-1,-D,-1>,< 1,1 ,1>}
scale <1,2.5,1>}
intersection{
sphere{<0,0,0>,1}
box{<-1,-1 ,-1>,< 1,0+0.01,1>}
}
} // end of merge
// -----------------------------------------
#local C__Flame =
object{
Flame__Shape
hollow
pigment{ color rgbf<1,1,1,1>}// clear!
finish { ambient 0 diffuse 0 }
interior {
media {
emission color rgb<1.0,0.75,0.1>*1.75
intervals 9
samples 1, 20
confidence 0.9999
variance 1/100
density{ spherical
ramp_wave
turbulence 0.15
color_map {
[0.0 color rgb <0.0,0.0,0.0>]
[0.6 color rgb <0.8,0.3,0.0>]
[0.9 color rgb <1.0,0.8,0.3>]
[1.0 color rgb <1.0,1.0,0.1>]
} // end color_map
scale <1,2.5,1>
} // end of density
}//end of media
}//------------------------------------------
|
|
media with simple spherical density_map and visible containter object - not scaled!
|
media with simple spherical density_map, scaled to flame shape.
|
The Inner Glowing media:
A density map with "crackle" cutted by second a spherical density map with soft borders.
media{
emission color rgb<1.0, 0.75, 0.1>*2.75
intervals 3
samples 32
method 3
aa_threshold 0.1 aa_level 5
density{ crackle turbulence 0.3
scale 0.75 translate<0,24,0>
color_map {
[0 rgb 0]
[0.00 rgb 0]
[0.07 rgb 1]
[0.10 rgb 1]
[0.12 rgb 0]
[1.00 rgb 0]
} // end color_map
} // end density
density{ spherical
color_map {
[0 rgb 0]
[0.7 rgb 1]
[1 rgb 1]
} // end color_map
} // end density
scale<1,2.5,1>*0.5
translate<0,0.01,0>
}// end media
//------------------------------------------
|
|
Added an inner glowing area with a second media with a crackle cut with soft borders by another spherical density map.
|
If we want the candle to shine, we should add a lightsource to the flame shape,
(note: "emission media" does not really shine!)
to get soft shadow borders we take an area_light which intensity is controlled by a number up from 0.
#if(Shining__On > 0) //---------------------
light_source{
<0,0,0>
color rgb <0.8, 0.5, 0.2>*Shining__On
area_light // kind of light source
<0,0,0><0,0.25,0>//lights spread area
1, 10 // total number of lights x,y
adaptive 3 // 0,1,2,3...
jitter // adds random softening of light
translate<0,CandleHeight+0.45,0>
} //---------------- end of area_light -----
#end // of "#if(Shining__On>0)"
|
|
Added a soft area_light to let the candles really shine!
|
For more realism it's a good idea to make the light source more wide and also
to add a second "area_light" rotated by 90 degrees.
Another proposition by Thierry Banel:
With "fade_distance" and "fade_power" we can simulate the fading
of the candle light at relatively short distance.
This object is available as a ready-made object for POV-Ray
here: Burning Candle
|
More realistic: "area_light" + "Fade_Distance" + "Fade_Power"!
Include file and samples for POV-Ray see "Candle_2" at
Ready-made Objects
|
|