POV-Ray : Newsgroups : povray.general : text on a cylinder Server Time
5 Aug 2024 18:19:00 EDT (-0400)
  text on a cylinder (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: James Taylor
Subject: text on a cylinder
Date: 4 Aug 2002 18:41:16
Message: <3d4dad8c@news.povray.org>
hi all,

I'm sure this must have been raised many times before, but how would I wrap
a text string around a cylinder. To clarify - the front of the letters
should be aligned normal to the cylinders curvature - like the letters on a
beer bottle label.

thanks in advance
jim


Post a reply to this message

From: Christopher James Huff
Subject: Re: text on a cylinder
Date: 4 Aug 2002 20:11:39
Message: <chrishuff-F8BF9B.19023704082002@netplex.aussie.org>
In article <3d4dad8c@news.povray.org>,
 "James Taylor" <jim### [at] blueyondercouk> wrote:

> I'm sure this must have been raised many times before, but how would I wrap
> a text string around a cylinder. To clarify - the front of the letters
> should be aligned normal to the cylinders curvature - like the letters on a
> beer bottle label.

If you want something like printing on a label, use a text object with 
the object pattern, and the mapping warps to wrap it around the 
cylinder. If you need actual objects for the text, you could get what 
you want by modifying the Circle_Text() macro in shapes.inc.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: text on a cylinder
Date: 4 Aug 2002 20:14:23
Message: <Xns9261162AEE1E7raf256com@204.213.191.226>
"James Taylor" <jim### [at] blueyondercouk> wrote in
news:3d4dad8c@news.povray.org 

> hi all,
> 
> I'm sure this must have been raised many times before, but how would I
> wrap a text string around a cylinder. To clarify - the front of the
> letters should be aligned normal to the cylinders curvature - like the
> letters on a beer bottle label.

probably best result will give isosurface - using inside() function and 
twist/rotate along Y axis.

object pattern/pigment will give totaly flat text, while ISO will give 
grooved text

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Christopher James Huff
Subject: Re: text on a cylinder
Date: 4 Aug 2002 22:27:32
Message: <chrishuff-E7A894.21182904082002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> probably best result will give isosurface - using inside() function and 
> twist/rotate along Y axis.

Best?!? Slowest and most likely to produce artifacts, if it works at 
all...isosurfaces don't like infinite gradients.


> object pattern/pigment will give totaly flat text, while ISO will give 
> grooved text

Don't know what you mean by "grooved" here. If you mean an engraved 
appearance, the object pattern as a normal could work, the normal will 
be perturbed at the boundaries of the object pattern. Or you could use 
the pattern blurring techniques to get smoother transitions on the 
edges, povray.binaries.scene-files has some work on this.
If a texture won't do and a real object is needed, the best thing would 
be to construct a union of the individual letters rotated into a 
circle...the Circle_Text() macro already does most of this, you just 
need to modify it a bit. If you need the outer surfaces to be curved, 
just intersect it with a cylinder.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Slime
Subject: Re: text on a cylinder
Date: 5 Aug 2002 05:22:17
Message: <3d4e43c9@news.povray.org>
> > probably best result will give isosurface - using inside() function and
> > twist/rotate along Y axis.
>
> Best?!? Slowest and most likely to produce artifacts, if it works at
> all...isosurfaces don't like infinite gradients.


If an isosurface is being used only for the purpose of the inside()
function, it will be very fast and perfectly accurate. Only one function
evaluation is necessary.

 - Slime
[ http://www.slimeland.com/ ]


Post a reply to this message

From: James Taylor
Subject: Re: text on a cylinder
Date: 5 Aug 2002 07:43:13
Message: <3d4e64d1@news.povray.org>
thanks for the replies but I figured it out...heres my solution:

#macro Text_Cylinder(Text,Radius,Text_Size)
    #local fudge = 0.6;
    #local Length = strlen(Text);
    #local Width = Text_Space(font,Text, 1, 0);
    #local Angle = degrees(Text_Size/Radius*fudge)*Length;
    #local i=1;
    union {
    #while (i<=Length)
        #local temp_letter = substr(Text,i,1)
        text{
            ttf font,temp_letter,1*mm, 0
            scale Text_Size
            translate -Radius*z
            rotate -degrees(Text_Size/Radius*fudge)*y*i
            pigment{Black}
            finish{Glossy}
        }
        #local i=i+1;
    #end
    rotate -90*y
    rotate Angle/2*y  //centres text
    }
#end


but why do I need to introduce the "fudge" factor?

thanks
jim


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: text on a cylinder
Date: 5 Aug 2002 07:47:34
Message: <Xns92618BB158E36raf256com@204.213.191.226>
Christopher James Huff <chr### [at] maccom> wrote in news:chrishuff-
E7A### [at] netplexaussieorg

>> probably best result will give isosurface - using inside() function and 
> Best?!? Slowest and most likely to produce artifacts, if it works at 
> all...isosurfaces don't like infinite gradients.

[...]

> If you need the outer surfaces to be curved, 
> just intersect it with a cylinder.

for normal text{} - this intersection is almost true, but of course for 
more complex objects the result of realy twisting it by ISO, or by 
intersection will be totaly different.

Even for text, when looking above :

   *    <- center of cylinder
.......
.     . 1 letter
.     . 
.......


   *
.,   ,.
. '-' . 1 letter + intersection
.     . <- this side line is straight | with is not totaly correct
.,   ,.
  '-'

   *
       
 .'-'.  1 letter + true twist using ISO
/     \ <- this side wall is alsow turned
',   ,'
  '-'
 
I will make POV to ilustrate this in evening



-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Christopher James Huff
Subject: Re: text on a cylinder
Date: 5 Aug 2002 12:21:58
Message: <chrishuff-5D7495.11114805082002@netplex.aussie.org>
In article <3d4e43c9@news.povray.org>, "Slime" <slm### [at] slimelandcom> 
wrote:

> > > probably best result will give isosurface - using inside() function and
> > > twist/rotate along Y axis.
> >
> > Best?!? Slowest and most likely to produce artifacts, if it works at
> > all...isosurfaces don't like infinite gradients.
> 
> If an isosurface is being used only for the purpose of the inside()
> function, it will be very fast and perfectly accurate. Only one function
> evaluation is necessary.

If it is being used only for that purpose, using an isosurface is 
completely unnecessary...use the function directly as a pattern. And 
since POV 3.5 has the mapping warps, using a function to do the same 
thing is just making it unnecessarily difficult. But I think he was 
talking about using it as an actual isosurface, since he mentioned an 
engraved appearance.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Christopher James Huff
Subject: Re: text on a cylinder
Date: 5 Aug 2002 12:40:38
Message: <chrishuff-5FBCEC.11303205082002@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:

> for normal text{} - this intersection is almost true, but of course for 
> more complex objects the result of realy twisting it by ISO, or by 
> intersection will be totaly different.

What are you talking about? The problem is about wrapping text around a 
cylinder, see the subject: "text on a cylinder"
For more complex objects, intersect it with a more complex object...it 
would work with cone, lathe or sor objects as well.

As for the straight sides, it is unlikely to be a problem or even to be 
visible to someone looking for it if the letters are fairly small in 
comparison to the cylinder. And you could use a technique similar to the 
bevelled text macro to adjust this and still get a result that is faster 
and more artifact-free than an isosurface.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Warp
Subject: Re: text on a cylinder
Date: 6 Aug 2002 15:36:23
Message: <3d502536@news.povray.org>
It amazes me that no-one has yet given the best, easiest and most obvious
answer:
  Create an object pattern with the text and then apply a cylindrical warp
to this pattern. That's it.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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