|
|
Thank you Warp. For some reason, I did not get your reply until after I posted
my last message. Anyway, that 'select' function is just the thing I've been
looking for. Using this approach, I was able to render a Mandelbulb in PovRay.
The following code is not very efficient, but it's an interesting demonstration.
Try it out!:
//runtime: 4 minutes, image size: 320x240
camera{location <-2.5,5,5> look_at <-0.5,0,0.25> up z sky z angle 25}
light_source{20*z,1}
#declare f=function(i,x,y,z,xc,yc,zc) {select(i>0 & x*x+y*y+z*z<4, 0,
sqrt(x*x+y*y+z*z),
f(i-1,(x*x-y*y)*(1-z*z/(x*x+y*y))+xc,2*x*y*(1-z*z/(x*x+y*y))+yc,-2*z*sqrt(x*x+y*y)+zc,xc,yc,zc))};
isosurface{function{f(24,x,y,z,x,y,z)-2} threshold 0 max_gradient 10
contained_by{sphere{<-0.5,0,0>,2}} pigment{rgb 1}}
In the process, I discovered something strange and evil about POV-Ray functions.
If I declare any helper functions before my 'f' function, everything goes
haywire. I'm not sure why this is, but it took me quite a while to discover this
problem.
Post a reply to this message
|
|