#include "textures.inc"
camera {
location <0.4,1,0.12> look_at <0.4, 0, 0.12>
}
sky_sphere { pigment { color rgb 1 } }
light_source {< 0, 0, -20> color rgb <1,0,0> }
#declare basis = union {
sphere{<0,0,0>, 0.2}
}
#declare fractal = basis;
#declare iterations = 0;
#while (iterations < 50)
#declare fractal = union {
object { basis }
object { fractal scale 0.8 translate <0,0,0.5> rotate<0, 45, 0>}
}
#declare iterations = iterations + 1;
#end
object {fractal
texture { DMFWood6 }
}
这是一个简单的递归定义生成分形结构(Spiral)的源代码,用3.6以上的版本运行。自己试一下就知道是什么样了。里面主要用到的技术是可以对一个对象变量进行递归重复定义。因为代码比较简单,不多说了。。。