POV-Ray : Newsgroups : povray.text.scene-files : Sphere made of Cubes Server Time
1 Nov 2024 03:14:31 EDT (-0400)
  Sphere made of Cubes (Message 1 to 3 of 3)  
From: Quietman
Subject: Sphere made of Cubes
Date: 5 Aug 2002 17:06:12
Message: <3d4ee8c4@news.povray.org>
/*
  Blocks Shape
  (c) 2002 D.A.Jackson
*/

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 255
}

// camera

camera {
  location <49, 53, 65>
  look_at <0, 21, 0>
  angle 40
}

// lights

light_source {
  <1000, 1000, 100>
  color White
  parallel
}

// sky

sky_sphere {
  pigment {
    color Gray50
  }
}

// ground

plane {
  y, 0
  pigment {
    granite
    turbulence 1
    color_map {
      [ 0 color Gray40 ]
      [ 1 color Gray60 ]
    }
    scale 5
  }
  normal {
    granite 1/5
    scale 5
  }
}

// object

#declare r = seed(1);
#declare r2 = seed(2);

#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
          pigment {
            color White
          }
          finish {
            specular 1
            roughness 1/200
            reflection 1/4
          }
          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




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.380 / Virus Database: 213 - Release Date: 24/07/2002


Post a reply to this message

From: Pandora
Subject: Re: Sphere made of Cubes
Date: 6 Aug 2002 21:10:07
Message: <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


Post a reply to this message

From: Quietman
Subject: Re: Sphere made of Cubes
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.