POV-Ray : Newsgroups : povray.newusers : Multiple Objects : Multiple Objects Server Time
4 Nov 2024 13:03:57 EST (-0500)
  Multiple Objects  
From: Kevin Becker
Date: 18 Sep 2003 13:09:04
Message: <3f69e6b0@news.povray.org>
I've created a pool ball in POV using a sphere & cylinder and using the
difference & intersection commands to make my Ball "wrapper" and Ball
"core."  See below for sample code.  How can I easily create a second ball
that's blue without copying the current code and making adjustments
accordingly?  I know how to create a second ball and move it around, but I
want to be able to change the color of the wrapper.  Also each ball will
have a number and I would like to be able to change that easliy.

camera {
        location <2, 2, -15>
        look_at <2, -2, -2>
}

light_source {
        <-50,100,-75>
        rgb <1,1,1>
        spotlight
        radius 50
}

background {
        rgb <1,1,1>
}

#declare ObjectSphere = sphere {
 <0,0,0>, 2
 finish {
  ambient .25
 }
}

#declare ObjectCylinder = cylinder {
 <0,0,0>+2*z, <0,0,0>-2*z, 2/3
}

#declare BallWrapper = difference {
 object {
  ObjectSphere
  pigment { rgb <1,0,0> }
 }
 object { ObjectCylinder }
}

#declare BallCore = intersection {
 object {
  ObjectSphere
  pigment { rgb <1,1,1> }
  }
 object { ObjectCylinder }
}

#declare ObjectBall = union {
 object { BallWrapper }
 object { BallCore }
}

object { ObjectBall }

Thanks for any help!


Post a reply to this message

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