camera { perspective location <0, 0, -50> look_at <0, 0, 0> right x*image_width/image_height angle 25 } #include "functions.inc" // for f_noise3d #declare clock_for_function = 108*clock; // 108 for the sine distortion of the isosurface container #declare clock_for_main_flames = 25*clock; // 25 for use in color_map PHASE, for upward 'speed' of flames #declare clock_for_turbulence = 16*clock; // 16 for TRANSLATING turbulence of large flames #declare clock_for_small_flames = 16*clock; // 16 for TRANSLATING turbulence of 'stationary' small flames. #declare mm = 2; // media density multiplier, to get flames looking bright and dense enough // the flame container isosurface{ function { // sphere formula sqrt(pow(x + .16*sin(3*pi*y - clock_for_function) + .16*sin(5*pi*y - clock_for_function),2) + pow(y,2) + pow(z + .16*sin(3*pi*y + 1 - clock_for_function) + .16*sin(5*pi*y + 1 - clock_for_function),2) ) - .95 // radius - f_noise3d(x*2,y*7 - clock_for_function,z*2)*.6 } max_gradient 2.1 accuracy .0001 contained_by{ sphere{0,2.12} // Large because the sphere function above is distorted } hollow pigment{color rgbt 1} #declare flame_color_map_1 = // for main EMITTING media color_map { // will be made gradient y below [0.0 rgb 0] [0.141 rgb 0] [0.182 rgb (<255,186,25>/255)*1] [0.325 rgb (<255,117,25>/255)*.8] [0.525 rgb (<255,117,25>/255)*.6] [0.675 rgb 0] [0.90 rgb 0] } #declare flame_color_map_2 = // for main ABSORBING media--gray version of above color_map { // will be made gradient y below [0.0 rgb 0] [0.141 rgb 0] [0.182 rgb (<255,186,25>/255).gray*1] [0.325 rgb (<255,117,25>/255).gray*.8] [0.525 rgb (<255,117,25>/255).gray*.6] [0.675 rgb 0] [1.0 rgb 0] } #declare flame_density_1 = density { gradient y warp{turbulence <0,.78,0> omega .5 lambda 2.1 octaves 5} translate 10*z // so the two turbulences have 'different' positions in space warp{turbulence <0,.78,0> omega .3 lambda 1.5 octaves 4} phase -clock_for_main_flames color_map {flame_color_map_1} scale <1,.232,1> translate clock_for_turbulence*z // or in y--but // that's trickier, because the color_map would be moved here as well } #declare flame_density_2 = // same as above, but using the gray color_map instead density { gradient y warp{turbulence <0,.78,0> omega .5 lambda 2.1 octaves 5} translate 10*z warp{turbulence <0,.78,0> omega .3 lambda 1.5 octaves 4} phase -clock_for_main_flames color_map {flame_color_map_2} scale <1,.232,1> translate clock_for_turbulence*z // see above } interior{ media{ // 1st media--EMISSION method 3 intervals 1 samples 8 // purposely low; looks better, IMO emission 1.0*mm density { gradient y density_map{ // for fade-out at top of flames [0.0 flame_density_1] [0.2 flame_density_1] [.95 rgb 0] } scale <1,2.04,1> // for an elongated shape translate -.71*y } } media{ // 2nd media--ABSORPTION method 3 intervals 1 samples 8 absorption 1.0*mm density { gradient y density_map{ // for fade-out at top of flames [0.0 flame_density_2] [0.2 flame_density_2] [.95 rgb 0] } scale <1,2.04,1> translate -.71*y } } // end of 2nd media media{ // 3rd media (has TWO things in it.) For additional non-moving BOTTOM // flickering flames. Although the turbulence does move. method 3 intervals 1 samples 8 emission 2.0*mm density { gradient y color_map{ [0.0 rgb 0] [0.11*.8 rgb 0] [0.14*.8 rgb <1,.5,0>*1] [0.22*.8 rgb <1,.3,0>*.8] [0.40*.8 rgb 0] } scale <1,2.6,1> // this is for moving only the turbulence (during animation) translate -clock_for_small_flames*y warp{turbulence <0,.3,0> omega .5 lambda 1.5 octaves 4} translate clock_for_small_flames*y scale <.8,1,.8> translate -1.0*y } absorption 2.5*mm density { gradient y color_map{ [0.0 rgb 0] [0.11*.8 rgb 0] [0.14*.8 rgb <1,.5,0>.gray*1] [0.22*.8 rgb <1,.3,0>.gray*.8] [0.40*.8 rgb 0] } scale <1,2.6,1> translate -clock_for_small_flames*y warp{turbulence <0,.3,0> omega .5 lambda 1.5 octaves 4} translate clock_for_small_flames*y scale <.8,1,.8> translate -1.0*y } } // end of 3rd media } // end of INTERIOR scale <1,6,1> }