POV-Ray : Newsgroups : povray.newusers : Simple 2D text on a cylinder's surface : Re: Simple 2D text on a cylinder's surface Server Time
28 Jul 2024 20:34:18 EDT (-0400)
  Re: Simple 2D text on a cylinder's surface  
From: Samuel Benge
Date: 12 Oct 2007 02:39:40
Message: <470f16ac$1@news.povray.org>
Marty Schrader wrote:
> This subject has been beaten to death on this group, but to no 
> satisfactory conclusion.

Here you go, Marty:

// begin code
#declare my_text=
text{
  ttf"arialbd.ttf"
  "Hello World!"
  10,0
  translate<0,-0.25,0>
}

cylinder{<0,-1,0>,<0,1,0>,1
  pigment{
   pigment_pattern{
    object{my_text 0,1}
    scale<0.1,1,1>
    warp{cylindrical}
    rotate y*180
   }
   pigment_map{
    [0 granite]
    [1 rgb 1]
   }
  }
}
// end code

I'm sure you can figure out the specifics of the my_text object for 
yourself.

The two numbers after my_text (inside the object{} block) are the colors 
for the background and foreground, respectively. The object pigment is 
scaled and a cylindrical warp is applied to it which essentially wraps 
it around the cylinder. To insure the granite pigment does not warp with 
the text, the object pigment is encased within a pigment_pattern block. 
This resets all the transformations outside the pigment_pattern block 
(including warps) and allows you to use a pigment_map with the object 
pigment. You can nest as many pigment_pattern blocks as you wish.

For more information, look these topics up:
  3.4.11.23  Object Pattern
  3.4.1.2  Color List Pigments
  3.4.1.4  Pigment Maps and Pigment Lists
  3.4.12.6.5  Mapping using warps
  3.4.11.25  Pigment Pattern
  3.3.1.13  Text


Post a reply to this message

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