POV-Ray : Newsgroups : povray.newusers : how to draw sth on the surface of a ball Server Time
2 Nov 2024 17:18:50 EDT (-0400)
  how to draw sth on the surface of a ball (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: mudong
Subject: how to draw sth on the surface of a ball
Date: 2 Oct 2003 18:15:02
Message: <web.3f7ca32d77d9a3bdfceeb1e0@news.povray.org>
I was asked to make sth for students which is like the smiling face in a
image on walmart's website

http://www.walmart.com/i/if/shp/header_52229.jpg,

below is what i got so far, but I just have no clue how to draw the mouth, I
don't know which tool to use to draw sth on a surface, could somebody
please help, many thanks!!!!!!

Mudong

************************************************************
 #include "colors.inc"
  background { color White }
  camera {
    location <0, 2, -5>
    look_at  <0, 1,  0>
  }
  sphere {
    <0, 1, 0>, 2
    texture {
      pigment { color red 1.6 green 1.4 blue 0 }

    }
  }
sphere_sweep {

  linear_spline
  3,

  <0,1.2,-1.989>, 0.03,
  <-0.14, 1.4,-1.9546>, 0.04,
  <-0.28, 1.6, -1.8872>, 0.03
               texture {
      pigment { color Black}
    }
}
     sphere_sweep {

  linear_spline
  3,
  <0.5,1.44,-1.88584>, 0.03 ,
  <0.4, 1.66, -1.8451>, 0.04,
  <0.3,1.88,-1.77076>, 0.03

               texture {
      pigment { color Black}
    }
}

  light_source { <2, 0.5, -9> color White}


Post a reply to this message

From: Christopher James Huff
Subject: Re: how to draw sth on the surface of a ball
Date: 2 Oct 2003 20:06:10
Message: <cjameshuff-76D02F.20053902102003@netplex.aussie.org>
In article <web.3f7ca32d77d9a3bdfceeb1e0@news.povray.org>,
 "mudong" <nomail@nomail> wrote:

> below is what i got so far, but I just have no clue how to draw the mouth, I
> don't know which tool to use to draw sth on a surface, could somebody
> please help, many thanks!!!!!!

Uh...what is "sth"? The actual letters, "sth"? I suggest the text object 
used together with the object pattern. Something like:

sphere {< 0, 0, 0>, 1
    texture {
        pigment {
            object {
                text {ttf "crystal.ttf", "sth", 1.01, 0
                    scale < 0.3, 0.3, 1>
                    translate <-0.15,-0.15,-1>
                }
                pigment {color rgb 0.5}
                pigment {color rgb 1}
            }
        }
    }
}

You could also use the macros in transforms.inc to position it more 
precisely, and warps to wrap it around the sphere.

-- 
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

From: mudong
Subject: Re: how to draw sth on the surface of a ball
Date: 2 Oct 2003 23:25:01
Message: <web.3f7ceb43d648f0f1fceeb1e0@news.povray.org>
Thanks a lot, what I actually want is a curve(a smiling mouth) on the
sphere, how to do that? thank you so much.

Mudong


Christopher James Huff wrote:
>In article <web.3f7ca32d77d9a3bdfceeb1e0[at]news.povray.org>,
> "mudong" <nomail[at]nomail> wrote:
>
>> below is what i got so far, but I just have no clue how to draw the mouth, I
>> don't know which tool to use to draw sth on a surface, could somebody
>> please help, many thanks!!!!!!
>
>Uh...what is "sth"? The actual letters, "sth"? I suggest the text object
>used together with the object pattern. Something like:
>
>sphere {< 0, 0, 0>, 1
>    texture {
>        pigment {
>            object {
>                text {ttf "crystal.ttf", "sth", 1.01, 0
>                    scale < 0.3, 0.3, 1>
>                    translate <-0.15,-0.15,-1>
>                }
>                pigment {color rgb 0.5}
>                pigment {color rgb 1}
>            }
>        }
>    }
>}
>
>You could also use the macros in transforms.inc to position it more
>precisely, and warps to wrap it around the sphere.
>
>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

From: Hughes, B 
Subject: Re: how to draw sth on the surface of a ball
Date: 3 Oct 2003 02:08:11
Message: <3f7d124b@news.povray.org>
"mudong" <nomail@nomail> wrote in message
news:web.3f7ceb43d648f0f1fceeb1e0@news.povray.org...
> Thanks a lot, what I actually want is a curve(a smiling mouth) on the
> sphere, how to do that? thank you so much.

Well, "sth" is a contraction for the word something, unless I'm mistaken.
:-)

Christopher actually gave you a good way of doing it, just don't use text
and instead use a CSG object.

Try this, for example:

#declare Smile=
union {
 // eyes
 sphere {0,1 scale <1/12,1/6,1/2> translate <-1/3,1/4,-1/2>}
 sphere {0,1 scale <1/12,1/6,1/2> translate <1/3,1/4,-1/2>}
difference {
 // mouth
    cylinder {-z*2,0,1 translate y/2}
    cylinder {-z*2,0,1.25 translate y}
    scale <0.5,0.25,0.5> translate -y/4
}
 // mouth corners
 sphere {0,1 scale <1/20,1/10,1/2> rotate -30*z translate <-1/2,-1/5,-1/2>}
 sphere {0,1 scale <1/20,1/10,1/2> rotate 30*z translate <1/2,-1/5,-1/2>}
}

sphere {
 0,1
 pigment {
  object {
   Smile
      pigment { color red 1.6 green 1.4 blue 0 }
      pigment { color rgb 0 }
  }
 }
 scale 2 translate y
}

Sorry if you wanted to make it yourself, or sth (ha ha), but I just had to
try it myself to see it and figured you might as well have it to look over.

Bob H.


Post a reply to this message

From:
Subject: Re: how to draw sth on the surface of a ball
Date: 3 Oct 2003 23:03:48
Message: <3f7e3894$1@news.povray.org>
// Hi Mudong,
//
// Here is one more smiley I've found lying around; this was my easter
// desktop. (Actually sort of eggsperiment ...) Instead of using the
// pigment{object{...}} method the eyes and mouth are created by CSG
// and clipped by intersection with a sphere slighty larger than the
// yellow head. Of course the mouth of Bob's smiley is much nicer than
// mine, but I wanted to leave something for you to do :-))
//
//    Sputnik



// Smilegg

// +SP8 +EP8 +A0.1 +AM2 +R3 +W512 +H384 -FN +D


#macro Egg (Color)
  #local R = 2; // 1: pointed top; >1: round top
  #local T = 0.5; // thickness factor
  cubic {
    <   //    x^2 + z^2 <= y^3 - R*y^2 - y + R = (y-R) * (y+1) * (y-1)
     0, // x^3
     0, // x^2*y
     0, // x^2*z
    +1, // x^2
     0, // x*y^2
     0, // x*y*z
     0, // x*y
     0, // x*z^2
     0, // x*z
     0, // x
    -1, // y^3
     0, // y^2*z
    +R, // y^2
     0, // y*z^2
     0, // y*z
    +1, // y
     0, // z^3
    +1, // z^2
     0, // z
    -R> // 1
    sturm
    scale <T, 1, T>
    clipped_by { box { <-1, -1, -1>, <1, 1, 1> } }
    bounded_by { clipped_by }
    translate y
    texture {
      pigment { color rgb Color }
      finish { ambient .2 diffuse .5 specular .3 roughness 1 }
      }
    }
  #end//macro Egg


#macro Smilegg (XPos)

  union {

    // sliced egg
    intersection {
      plane { -z, 0.3
        texture {
          pigment { color rgb 1 }
          finish { ambient .8 }
          }
        }
      Egg (<1, .75, .5>)
      }

    // core of egg = head of smiley
    sphere { 0.8*y, 0.5
      texture {
        pigment { rgbt <1, .9, .3, 0> }
        finish { ambient .6 diffuse .6 }
        }
      }

    // eyes and mouth
    intersection {
      // clipping sphere
      sphere { 0.8*y, 0.501 }
      #local X = 0.2;
      #local Y = 0.95;
      union {
        // eyes
        cylinder { <-X, Y, -1>, <-X, Y, 1>, 0.07 }
        cylinder { < X, Y, -1>, < X, Y, 1>, 0.07 }
        // mouth
        difference {
          #local R = 0.4;
          // difference of two coaxial cylinders ...
          cylinder { -z, z, R }
          cylinder { -1.01*z, 1.01*z, R-0.07 }
          // ... reduced to a segment
          plane { -y, 0 rotate  40*z }
          plane { -y, 0 rotate -40*z }
          rotate -10*x
          translate (R+0.55)*y
          }
        }
      texture {
        pigment { color rgb 0 }
        finish { specular .5 }
        }
      }//intersection

    translate XPos*x

    }//union

  #end//macro Smilegg


Smilegg (-0.8)
Smilegg ( 0.8)

background { color <58, 110, 165>/255 }
light_source { <-10, 10, -5>, 1 }
camera { location <0, 1.5, -6> look_at y angle 30 }


Post a reply to this message

From: Mike Williams
Subject: Re: how to draw sth on the surface of a ball
Date: 4 Oct 2003 01:05:36
Message: <sjP3mJA8Slf$Ewr4@econym.demon.co.uk>
// Hi Mudong,
//
// Here's one that I found lying around on my system. I don't know who
// wrote it. I think it got posted to one of the povray groups in 
// January 2000, but I've so far failed to find the original posting.

#include "colors.inc"

background {color rgb <203/255, 203/255, 211/255>}

camera {location <0, 0, -3>}

light_source {<5, 0, -10> color White}

#declare Curl1 =
texture {
pigment {
average
pigment_map {
[1 cylindrical
color_map {
[0 .16 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
[.2 color Black]
[.3 .34 color Black color rgbt <1, 1, 1, 3>]
}
scale <.7, 1, .8>
rotate 90*x
translate <-.75, .25, 0>
]

[1 boxed
color_map {
[0 .18 color Black color Black]
[.2 1 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
}
scale 2
rotate -25*z
translate <-0, 1.5, 0>
]

[1 boxed
color_map {
[0 .18 color Black color Black]
[.2 1 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
}
scale 2
//rotate 25*z
translate <-2.25, 0, 0>
]
}
}
}

#declare Curl2 =

texture {
pigment {
average
pigment_map {
[1 cylindrical
color_map {
[0 .16 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
[.2 color Black]
[.3 .34 color Black color rgbt <1, 1, 1, 3>]
}
scale <.7, 1, .8>
rotate 90*x
translate <.75, .25, 0>
]

[1 boxed
color_map {
[0 .18 color Black color Black]
[.2 1 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
}
scale 2
rotate 25*z
translate <-0, 1.5, 0>
]

[1 boxed
color_map {
[0 .18 color Black color Black]
[.2 1 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
}
scale 2
//rotate 25*z
translate <2.25, 0, 0>
]
}
}
}

#declare Smiley_texture =
texture {
pigment {color Yellow}
finish {ambient .1 phong 0 phong_size 10 diffuse 1 metallic}
}

texture {
pigment {
spherical
color_map {
[0 .8 color rgbt <1, 1, 1, 1> color rgbt <1, 1, 1, 1>]
[.82 1 color Black color Black]
}
scale 1
translate -1*z
rotate <10, 20, 0>
}
finish {ambient .3}
}

texture {
pigment {
spherical
color_map {
[0 .8 color rgbt <1, 1, 1, 1> color rgbt <1, 1, 1, 1>]
[.82 1 color Black color Black]
}
scale 1
translate -1*z
rotate <10, -20, 0>
}
finish {ambient .3}
}

texture {
pigment {
average
pigment_map {
[1
cylindrical
color_map {
[0 .16 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
[.2 color Black]
[.3 .34 color Black color rgbt <1, 1, 1, 3>]
}
scale <.7, 1, .8>
rotate 90*x
]

[1
boxed
color_map {
[0 .18 color Black color Black]
[.2 1 color rgbt <1, 1, 1, 3> color rgbt <1, 1, 1, 3>]
}
scale 2
translate 1.4*y


]
}
}

}

texture {Curl1}

texture {Curl2}

sphere {<0, 0, 0>, 1 texture {Smiley_texture} }


Post a reply to this message

From: Hughes, B 
Subject: Re: how to draw sth on the surface of a ball
Date: 4 Oct 2003 03:24:57
Message: <3f7e75c9@news.povray.org>
"Mike Williams" <mik### [at] econymdemoncouk> wrote in message
news:sjP3mJA8Slf$Ewr4@econym.demon.co.uk...
>
> // Here's one that I found lying around on my system. I don't know who
> // wrote it. I think it got posted to one of the povray groups in
> // January 2000, but I've so far failed to find the original posting.

Hmmmm, sure reminds me of something Mike Hough had put on a tutorial web
page. I just can't remember at all now. Couldn't get to his tutorial pages
anymore when I tried to find out what he had done.

Those egg yolk smilies of Frank's could make a person have abnormal fears of
boiled eggs. Well, could me anyhow. I know I would freak out if I opened
eggs and found those there. Interesting way of going about creating them.
And thanks for the comment about mine, Frank! I went for simplicity, hence
the fractions in the vectors to estimate where things ought to be versus
using decimal numbers. I seldom do that but figured it would read better.

Bob H.


Post a reply to this message

From:
Subject: Re: how to draw sth on the surface of a ball
Date: 4 Oct 2003 18:20:04
Message: <3f7f4794$1@news.povray.org>
// Hi Mudong and Bob,
//
// I've played around with smileys with 3D-eyes and mouth; the
// following code (this time without eggs to avoid the "abnormal
// fears" of Bob) shows a collection of smileys with varying
// mouth. Changing the transparency of the yellow sphere's pigment
// to rgbt <1, .9, .3, .5> will show the "inner parts" of the
// mouth-torus. And of course modifying the other constants in
// the code for eyes and mouth gives funny results!
//
//    Sputnik



// Smileys

// +SP8 +EP8 +A0.1 +AM2 +R3 +W1024 +H768 -FN +D


#macro Smiley (Wide, Thick, Pos)
// Wide controls the width of the mouth (0.8 ... 1.1)
// Thick controls the thickness of "the lip" (0.6 ... 1.4)
// Pos is the position of the smiley's center

  union {

    union {

      // core of egg = head of smiley
      sphere { 0, 0.5
        pigment { rgbt <1, .9, .3, 0> } // change the transparency to
                                        // 0.5 to see what's going on!
        finish { ambient .6 diffuse .6 }
        }

      // eyes
      sphere { 0, 0.1      // get an eye ball
        scale <1, 1, 0.4>  // make it flat
        translate -0.5*z   // put onto surface of head at nose position
        rotate <20, 30, 0> // rise and turn to it's final position
        }
      sphere { 0, 0.1
        scale <1, 1, 0.2>
        translate -0.5*z
        rotate <20, -30, 0>
        }

      // mouth
      torus { 0.3, 0.1          // get a torus inside head
        scale <Wide, Thick, 1>  // make small/wide / thin/fat mouth
        translate <0, 0.2, -0.1>// pull up and towards face -- this
                                // gives a mouth at eyebrows position
        rotate -65*x            // rotate mouth to correct position
        }

      texture {
        pigment { color rgb 0 }
        finish { specular .6 }
        }

      }//union

    translate Pos

    }//union

  #end//macro Smiley


#declare Row = 0; // Row = 0, 1, 2
#while (Row<3)

  #declare Thickness = 0.6+0.4*Row;
  #declare Y = 1.3*(Row-1);

  #declare Column = 0; // Column = 0, 1, 2, 3
  #while (Column<4)

    #declare Width = 0.8+0.1*Column;
    #declare X = 1.3*(Column-1.5);

    Smiley (Width, Thickness, <X, Y, 0>)

    text { ttf "timrom.ttf"
      concat(
        "Smiley(", str(Width,3,1), ", ", str(Thickness,3,1),
        ", <", str(X,3,1), ",", str(Y,3,1), ",0>)"
        )
      0.1, 0
      scale 0.09
      translate <X-0.55, Y-0.6, 0>
      }

    #declare Column = Column+1;
    #end//while Column

  #declare Row = Row+1;
  #end//while Row


background { color <58, 110, 165>/255 }
light_source { <-10, 3, -8>, 1 }
camera { location -10*z look_at 0 angle 30 }


Post a reply to this message

From: Hughes, B 
Subject: Re: how to-- smilies, or smileys : )
Date: 4 Oct 2003 21:15:57
Message: <3f7f70cd@news.povray.org>
Still weird. That top row makes me think of the old Pac Man game character,
and maybe the one at far right is after he won.


Post a reply to this message

From:
Subject: Re: how to-- PacSmileys: (*< (*-) (*<
Date: 5 Oct 2003 00:59:52
Message: <3f7fa548$1@news.povray.org>
// Hi Bob,
//
// PacMan-smileys? Good idea -- I've made some ...
//
// BTW: smileys = 1,110,000 google hits
//      smilies = 2,780,000 google hits
//      So I'm with a strong minority which is perfectly O.K.
//      because my weird smileys also are a minority!
//
//    Sputnik
//
// P.S. I don't know why I used two unions in the smiley of
//      my last post; that is nonsense.



// PacMan-Smileys

// +SP8 +EP8 +A0.1 +AM2 +R3 +W1024 +H768 -FN +D


#macro PacSmiley (Upper, Lower, Pos)
// Upper is angle of upper lip below nose
// Lower is angle of lower lip below nose
// Pos is the position of the smiley's center

  union {

    difference {

      // head of smiley
      sphere { 0, 0.5
        pigment { rgbt <1, .9, .3, 0> }
        finish { ambient .6 diffuse .6 }
        }

      // mouth
        intersection {
          plane { y, 0 rotate -Upper*x }
          plane {-y, 0 rotate -Lower*x }
        }

    }//difference

    // eyes
    sphere { 0, 0.1      // get an eye ball
      scale <1, 1, 0.4>  // make it flat
      translate -0.5*z   // put onto surface of head at nose position
      rotate <30, 50, 0> // rise and turn to it's final position
      }
    sphere { 0, 0.1
      scale <1, 1, 0.2>
      translate -0.5*z
      rotate <30, -50, 0>
      }

    texture {
      pigment { color rgb 0 }
      finish { specular .6 }
      }

    rotate -50*y
    translate Pos

    }//union

  #end//macro Smiley


#declare Row = 0; // Row = 0, 1, 2
#while (Row<3)

  #declare Mid = 5+15*Row;
  #declare Y = 1.3*(Row-1);

  #declare Column = 0; // Column = 0, 1, 2, 3
  #while (Column<4)

    #declare Open = 5+25*Column;
    #declare X = 1.3*(Column-1.5);

    #declare Upp = Mid-Open/2;
    #declare Low = Mid+Open/2;
    PacSmiley (Upp, Low, <X, Y, 0>)

    text { ttf "timrom.ttf"
      concat(
        "PacSmiley(", str(Upp,2,0), ", ", str(Low,2,0),
        ", <", str(X,3,1), ",", str(Y,3,1), ",0>)"
        )
      0.1, 0
      scale <0.08, 0.09, 0.1>
      translate <X-0.55, Y-0.6, 0>
      }

    #declare Column = Column+1;
    #end//while Column

  #declare Row = Row+1;
  #end//while Row


background { color <58, 110, 165>/255 }
light_source { <10, 3, -8>, 1 }
camera { location -10*z look_at 0 angle 30 }


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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