// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 // MandelBulb.pov // Scene file for POV-Ray // By Tor Olav Kristensen // January 2010 // http://subcube.com // // See this newsgroup thread in povray.binaries.scene-files: // From: waggy // Subject: f_mandelbulb.010.zip // Date: 19th December 2009 // http://news.povray.org/povray.binaries.scene-files/thread/%3C4b2c7b3f%40news.povray.org%3E // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #version 3.6; #include "colors.inc" #include "functions.inc" // For f_r(), f_ph() and f_th() // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #macro MandelBulbFunction(R_Pwr, R_BO, Ph_Pwr, Ph_Phase, Th_Pwr, Max_Iter) #local ln_R_BO = ln(R_BO); #local ln_R_Pwr = ln(R_Pwr); #local J = Max_Iter - 1; #local MB_Fns = array[Max_Iter][2] #local I = Max_Iter; #while (I > 0) #local I = I - 1; #local MB_Fns[I][1] = function(x, y, z, _r, _rp, _ph, _th) { #if (I = J) 0 #else select( _r - R_BO, MB_Fns[I+1][0]( x, y, z, x + _rp*cos(_ph)*cos(_th), y + _rp*sin(_ph), z + _rp*cos(_ph)*sin(_th) ), 1/(I - ln(ln(_r)/ln_R_BO)/ln_R_Pwr) ) #end // if } #local MB_Fns[I][0] = function(x, y, z, _ix, _iy, _iz) { MB_Fns[I][1]( x, y, z, f_r(_ix, _iy, _iz), pow(f_r(_ix, _iy, _iz), R_Pwr), Ph_Pwr*(f_ph(_ix, _iy, _iz) + Ph_Phase), Th_Pwr*f_th(_ix, _iy, _iz) ) } #end // while function { MB_Fns[0][0](x, y, z, x, y, z) } #end // macro MandelBulbFunction // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #declare Power_Radius = 8; #declare Power_Phi = 8; #declare Power_Theta = 8; #declare Bailout_Radius = 3.0; #declare Phase_Phi = pi/2; #declare Max_Iterations = 5; isosurface { MandelBulbFunction( Power_Radius, Bailout_Radius, Power_Phi, Phase_Phi, Power_Theta, Max_Iterations ) threshold 0.5 max_gradient 20 // This value should probably be increased accuracy 0.001 contained_by { sphere { <0, 0, 0>, 1.2 } } texture { pigment { color White } } } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 light_source { <2, 2, 2>*100 color White // shadowless } light_source { <2, -2, -2>*100 color White // shadowless } camera { location <0, 2, 2> look_at <0, 0, 0> } background { color Gray40 + Blue } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7