|
 |
Well, I'm not sure I have the terminology correct, but here is a "Menger
gasket" pigment (on a box object). Has anything like this method been
posted before? It should be a trivial matter to generalize this to a real
Menger sponge (just add in z functions, and put into an isosurface). Well
enough blabbing, the scene file is below, followed by the picture,
Quadhall
#version unofficial MegaPOV 0.7;
camera
{
location <0,0,-6>
look_at <0,0,0>
orthographic
right <1.1,0,0>
up <0,1.1,0>
}
light_source { <0,0,-6> 1 }
////pigment code beginning
#declare delta=cos(pi/3);
#declare x1w=2*pi;
#declare y1w=2*pi;
#declare x2w=6*pi;
#declare y2w=6*pi;
#declare x3w=18*pi;
#declare y3w=18*pi;
#declare x4w=54*pi;
#declare y4w=54*pi;
#declare x5w=162*pi;
#declare y5w=162*pi;
#declare xx1=function{if(cos(x*x1w)-delta,1,0)}
#declare yy1=function{if(cos(y*y1w)-delta,1,0)}
#declare binary1=function{xx1*yy1}
#declare xx2=function{if(cos(x*x2w)-delta,1,0)}
#declare yy2=function{if(cos(y*y2w)-delta,1,0)}
#declare binary2=function{if(binary1,binary1,xx2*yy2)}
#declare xx3=function{if(cos(x*x3w)-delta,1,0)}
#declare yy3=function{if(cos(y*y3w)-delta,1,0)}
#declare binary3=function{if(binary2,binary2,xx3*yy3)}
#declare xx4=function{if(cos(x*x4w)-delta,1,0)}
#declare yy4=function{if(cos(y*y4w)-delta,1,0)}
#declare binary4=function{if(binary3,binary3,xx4*yy4)}
#declare xx5=function{if(cos(x*x5w)-delta,1,0)}
#declare yy5=function{if(cos(y*y5w)-delta,1,0)}
#declare binary5=function{if(binary4,binary4,xx5*yy5)}
#declare two_d_menger=
pigment
{
function{binary5}
//to make the pigment simpler, use binaryX, where X is 4 or less.
//to make the pigment more complicated, follow the logical progression for
adding functions.
color_map
{
[0 color rgb 1 ]
[1 color rgb 0 ]
}
}
////pigment code end
box{ <.5,.5,0> <-.5,-.5,-.1> pigment{two_d_menger} finish{ambient 1} }
Post a reply to this message
Attachments:
Download 'menger.png' (40 KB)
Preview of image 'menger.png'

|
 |