|
![](/i/fill.gif) |
As all the cubes in your sphere have the same pigment and finish, you can
wrap the whole object in a union {...} and apply the pigment and finish to
that. See below :
// object
#declare r = seed(1);
#declare r2 = seed(2);
union {
#declare zloop = -20;
#while (zloop < 21)
#declare yloop = -20;
#while (yloop < 21)
#declare xloop = -20;
#while (xloop < 21)
#declare s = cos(abs(xloop)/20) + cos(abs(yloop)/20) +
cos(abs(zloop)/20);
#if ((s > 2.54) & (s < 2.58))
box {
-0.45, 0.45
rotate <rand(r2)*90, rand(r2)*90, rand(r2)*90>
translate <xloop, yloop + 21, zloop>
}
#end
#declare xloop = xloop + 1;
#end
#declare yloop = yloop + 1;
#end
#declare zloop = zloop + 1;
#end
pigment {
color White
}
finish {
specular 1
roughness 1/200
reflection 1/4
}
}
Of course, if you, subsequently, want to apply a different pigment and
finish to each cube, your code is superior...
--
Pandora/Scott Hill/[::O:M:C::]Scorpion
Software Engineer.
http://www.pandora-software.com
Post a reply to this message
|
![](/i/fill.gif) |