POV-Ray : Newsgroups : povray.text.scene-files : Cheerios Server Time
22 Dec 2024 23:02:54 EST (-0500)
  Cheerios (Message 1 to 1 of 1)  
From: Corey Woodworth
Subject: Cheerios
Date: 20 Mar 2002 15:00:44
Message: <3c98ea6c$1@news.povray.org>
I'm making this scene just so I can learn about macros. I have a few
questions. How come the cheerios are alwawys contained within what looks
like a square even though I'm useing a disc in VRand_In_Obj? Also how can I
get the look to make sure the ceerios don't overlap?

Thanks,
Corey

#version 3.5;

#include "colors.inc"
#include "rand.inc"

global_settings {
  assumed_gamma 1.0
}

#declare Cheerio =
torus {
  0.06,
  0.02
  pigment {color rgb <1,.8,.5> }
}


#declare area =
disc {
  <0, -.4, 0>
  y,
  .65,
}

#macro FillBowl ()
  #declare Index = 1;
  #while(Index <= 90)
    object {Cheerio
    translate VRand_In_Obj(area, RdmB)
    }
    #declare Index = Index + 1;
  #end
#end

// ----------------------------------------

camera {
  location  <0.0, 3, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

plane {
  y, -1
  pigment { color rgb <0.7,0.5,0.3> }
}
merge {
  difference {
    sphere { 0.0, 1 }
    box { <-2, 0, -2>  < 2,  2,  2> }
    sphere { 0.0, .98 }
    cylinder { -1*y,  0*y,  .7 }
  }
  torus { 0.99, 0.01 }
  cylinder { -.75*y,  -.68*y,  .7 }
  texture {
    pigment {
      gradient y       //this is the PATTERN_TYPE
      color_map {
        [0.0  color White]
        [0.9  color White]
        [0.91  color rgb <0,.5,0>]
        [0.95  color rgb <0,.5,0>]
        [0.96  color White]
        [1.0  color White]
      }
    }
    normal { crackle .1 scale .02 metric 1}
    finish { specular 1 roughness .05}
  }
  translate y*-.25
}

difference {
  sphere { 0.0, .98 }
    box { <-2, -.15, -2>  < 2,  2,  2> }
  translate y*-.25
  pigment {color White }
  finish  {ambient .6}
}

FillBowl ()


Post a reply to this message

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