// ---------------------------------------- // To see the real isosurface: // #declare approximateISO = no; // To produce a smooth_triangle approximation: // #declare approximateISO = yes; #declare isoSmooth = yes; // To produce a flat triangle approximation: // #declare approximateISO = yes; #declare isoSmooth = no; // ---------------------------------------- #include "functions.inc" /* //#declare Fn = function { f_torus(x, y, z, 1, 0.4) } //#declare Fn = function { y - sin(2*x*z)*cos(x*z) } #declare Fn = function { cos(2*pi*x) + cos(2*pi*y) + cos(2*pi*z) } #declare isoThreshold = 0.0; #declare R = 2.0; #declare isoMin = -<1, 1, 1>*R; #declare isoMax = +<1, 1, 1>*R; */ #declare Scene_scale = 1; #declare R = Scene_scale * 2; #declare Blob_radius = 2*Scene_scale; #declare Blob_distance = 1*Scene_scale; #declare Blob_threshold_1 = 3; #declare Blob_threshold_2 = 3; #declare Blob_boxsize = <1,1,1,> * R; //#declare fn_A = function { Blob_radius / sqrt(pow(x+Blob_distance,2) + pow(y,2) + pow(z,2)) }; //#declare fn_B = function { Blob_radius / sqrt(pow(x-Blob_distance,2) + pow(y,2) + pow(z,2)) }; //#declare fn_C = function { Blob_threshold_1 }; //#declare fn_D = function { fn_A(x,y,z) + fn_B(x,y,z) - fn_C(x,y,z) }; //#declare fn_E_1 = function { -1 * min(Blob_threshold_2, max(0, fn_D(x,y,z))) }; #declare fn_E_2 = function { -1 * min(Blob_threshold_2, max(0, Blob_radius / sqrt(pow(x+Blob_distance,2) + pow(y,2) + pow(z,2)) + Blob_radius / sqrt(pow(x-Blob_distance,2) + pow(y,2) + pow(z,2)) - Blob_threshold_1)) }; #declare Fn = function { fn_E_2(x,y,z) } #declare isoMin = -Blob_boxsize; #declare isoMax = +Blob_boxsize; // Set to yes to produce the approximation or to no for actual isosurface #declare approximateIso = yes; #if (approximateIso) // #declare Depth = 1; // Set to 0 for no recursion // #declare isoSmooth = yes; // #declare isoSegs = <1, 1, 1>*6; #declare isoFileOption = 1; #declare isoFile = "triangles.inc"; #declare isoName = "Surface"; // #include "isosurface_kl_jf_tok.inc" // #include "isosurf_kl_jf.inc" #include "isosurfacejf9.inc" // #include "isosurface.inc" object { Surface pigment { color rgb <1, 1, 1>*0.9 } finish { phong 0.5 phong_size 10 } } #else isosurface { function { Fn(x, y, z) } max_gradient 8.0 contained_by { box { isoMin, isoMax } } open pigment { color rgb <1, 1, 1>*0.9 } finish { phong 0.5 phong_size 10 } } #end // if // ---------------------------------------- sky_sphere { pigment { function { abs(y) } color_map { [ 0.0 color rgb <0.0, 0.0, 0.6> ] [ 1.0 color rgb <1.0, 1.0, 1.0> ] } } } camera { location <1, 2, -4>*2*R look_at <0, 0, 0> angle 32 } light_source { <1, 2, -1>*100 color rgb <1, 1, 1> shadowless } light_source { <-1, -2, -1>*100 color rgb <1, 1, 1>*0.5 shadowless } // ----------------------------------------