|
 |
Bill DeWitt wrote:
>
> Are you saying that this is an isosurface? I have been expecting to see
> a fractal isosurface soon but I didn't know one had been made.
No, I wrote that! :-) Yes, it is isosurface, like this (POVMan 0.7 is
required for running it, more complete example comes with
documentation):
#declare xyf=function{
shader{
shader_file "menger.slp"
"rec_depth" 20
}
}
isosurface {
function {
xyf
}
contained_by { box { -1.0,1.0 } }
all_intersections
max_gradient 100
accuracy 0.001
texture {
...
}
scale 2
}
shader file is as follows:
iso_function menge(float rec_depth = 8){
float testfirst(output float mx, mn){
float rv = -1;
mx *= 3;
mn *= 3;
float i;
extern float rec_depth;
for (i=0; i<rec_depth;i+=1){
if(mx<=1 && mn <= 1){
rv = 1;
break;
}
else{
mx = abs(mod(mx*3+1, 6) -1);
mn = abs(mod(mn*3+1, 6) -1);
}
}
return rv;
}
float retv = -1;
if (testfirst(abs(xcomp(P)),abs(ycomp(P))) == 1 ||
testfirst(abs(xcomp(P)),abs(zcomp(P))) == 1 ||
testfirst(abs(zcomp(P)),abs(ycomp(P))) == 1)
retv = 1;
return retv;
}
Post a reply to this message
|
 |