#include "colors.inc" camera { location <2, 2, -5> look_at <0, 0, 0> } light_source { <100, 100, -10> color White} #macro sierpinski(s, base_center, recursion_depth) #if (recursion_depth > 0) union { sierpinski(s / 2, base_center + s/2*y, recursion_depth - 1) sierpinski(s / 2, base_center - s/2*(x+z), recursion_depth - 1) sierpinski(s / 2, base_center - s/2*(x-z), recursion_depth - 1) sierpinski(s / 2, base_center - s/2*(-x+z), recursion_depth - 1) sierpinski(s / 2, base_center - s/2*(-x-z), recursion_depth - 1) } #else difference{ box { <1,1,1>, <-1,0,-1> } plane{ x-y, -sqrt(2)/2} plane{ -x-y, -sqrt(2)/2} plane{ z-y, -sqrt(2)/2} plane{ -z-y, -sqrt(2)/2} scale s*1.0 translate base_center pigment { rgb <1,0,0>} } #end #end sierpinski(2,<0,0,0>,3) plane { y, // unit surface normal, vector points "away from surface" -1.0 // distance from the origin in the direction of the surface normal pigment { rgb <.3,.3,1>} }