POV-Ray : Newsgroups : povray.text.scene-files : Sphere made of Cubes : Re: Sphere made of Cubes Server Time
1 Jul 2024 03:17:40 EDT (-0400)
  Re: Sphere made of Cubes  
From: Quietman
Date: 9 Aug 2002 18:14:58
Message: <3d543ee2@news.povray.org>
Yes you are right, but I was "playing around" with different textures for
each cube :)

"Pandora" <pan### [at] pandora-softwarecom> wrote in message
news:3d50736f@news.povray.org...
> 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
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.