camera {location <1,1.2,-1.7> up y right x look_at <0,0,0> } light_source {< 100, 80, 100> colour rgb <1,1,1> } light_source {< 100, 80, -100> colour rgb <1,1,1> } light_source {< 100, 80, -100> colour rgb <1,1,1> } light_source {<-100, 80, -100> colour rgb <1,1,1> } background { rgb <1,1,1> } #macro te(c) texture { pigment { rgb c } finish { phong 1.0 phong_size 10 ambient 0.1 diffuse 0.7 } } #end #declare maxrecursion=4; #macro shirpinski(p,w,n) #local hw=w/2; #local fw=w/4; #if (n>=maxrecursion) union { triangle { p,p+< hw,-w,-hw>,p+< hw,-w, hw> } triangle { p,p+< hw,-w, hw>,p+<-hw,-w, hw> } triangle { p,p+<-hw,-w, hw>,p+<-hw,-w,-hw> } triangle { p,p+<-hw,-w,-hw>,p+< hw,-w,-hw> } triangle { p+< hw,-w, hw>,p+<-hw,-w, hw>,p+<-hw,-w,-hw> } triangle { p+<-hw,-w,-hw>,p+< hw,-w,-hw>,p+< hw,-w, hw> } te(p) } #else shirpinski(p,hw,n+1) shirpinski(p+< fw,-hw,-fw>,hw,n+1) shirpinski(p+< fw,-hw, fw>,hw,n+1) shirpinski(p+<-fw,-hw, fw>,hw,n+1) shirpinski(p+<-fw,-hw,-fw>,hw,n+1) #end #end union { shirpinski(<0,1,0>,1.3,0) translate -y*0.5 rotate y*30 translate y*0.5 }