|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
See my #declare/Object coloring question for a partial solution, for
creating copies for your balls, dont know about the numbering though.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The Macro works great! Now if I want a new ball, I just type:
CreateBall (Color, Location, Striped (T or F), "Number or Letter")
I've got to figure out how to get the width of my Letter/Number and center
that on the dot. Thanks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
// Hi Kevin!
//
// Here follows a ball macro which might do what you need.
//
// Sputnik
// Pool Ball
#macro PoolBall (Radius, Color, Number)
#local PoolBallFinish = finish {
ambient .3
diffuse .7
specular .3 roughness 0.01
reflection .2
}
union {
// main sphere
sphere { 0, Radius
pigment { color Color }
finish { PoolBallFinish }
}
// core
intersection {
cylinder { -Radius*z, Radius*z, .65*Radius }
sphere { 0, Radius*1.001 } // slightly larger radius to
// avoid coincident surfaces
pigment { color rgb 1 }
finish { PoolBallFinish }
}
#if (Number>0)
// number
#local Num = text { ttf "arial.ttf" str(Number,0,0) Radius/4, 0 }
#local Num = intersection {
object { Num
translate -max_extent(Num)/2 // center around origin
scale 1.2*Radius // make bigger
translate -Radius*z // transfer to surface of ball
}
sphere { 0, Radius*1.002 } // slightly larger radius to
// avoid coincident surfaces
pigment { color rgb 0.2 }
finish { PoolBallFinish }
}
// number on -z side
object { Num }
// number on +z side
object { Num rotate 180*y}
#end//if
// no "}" to allow for application of modifiers
#end//macro Ball
// put a ball into the scene
PoolBall (2, rgb <.8, .2, .1>, 4) /*{*/ rotate 30*z translate 2*y}
// one more ball; don't know if colors match numbers
PoolBall (0.8, rgb <.2, .2, .8>, 5) /*{*/ rotate <50, -70, 0>
translate <-2, 0.6, -2.5> }
// small ball without number
// (of course a simple sphere would suffice)
PoolBall (1.2, rgb 1, 0) /*{*/ translate <3, 0.6, -1.5> }
// reflecting balls need a checkered plane to survive ...
plane { y, 0
pigment { checker color green .6 color green .55 }
finish { ambient .3 diffuse .7 }
}
light_source { <-2, 3, -1>*10, color rgb 1 }
camera { location -20*z look_at 0 angle 25 rotate <30, -20, 0>
translate 1*y }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <3f69e6b0@news.povray.org>,
"Kevin Becker" <ksb### [at] NOSPAMyahoocom> wrote:
> 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.
You've already been told about macros, but you might also look at the
object pattern. There's no need to use anything more than a sphere for a
pool ball.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks for everyone's help. Here's the end result:
http://www.kingswoodhomes.com/images/cgbilliards.jpg
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|