 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
This subject has been beaten to death on this group, but to no satisfactory
conclusion.
How does one go about laying 2D text -- like a label or a painted stencil -- on
to the surface of a cylinder? This seems to be a pretty common problem for us
noobs. Nobody has come up with a straightforward answer yet.
Please include some POV example source. Additionally, if you refer to some POV
term such as "object pattern" please include a reference number for the help
facility. I have searched for "object pattern" all over the help and can't find
this term used anywhere.
A general description of the technique used to solve problems doesn't help us
newbies very much. It is particularly unhelpful to say something like "start by
looking at the documentation for XYZ keyword and work from there." Look, if you
guys know this stuff then please help the noobular get going with specifics.
POV is a pretty intimidating renderer, with more power than you can shake a
memory stick at. It's very hard for somebody to get a project going when the
rendered image is only a small part of the overall project results, so we can't
dedicate eight work hours a day researching this stuff. Once the newb gets past
the Big Hurdle then the rest of it seems to come a lot quicker. Eh?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Marty Schrader <mar### [at] parsecsystemsinc com> wrote:
> How does one go about laying 2D text -- like a label or a painted stencil -- on
> to the surface of a cylinder?
Here's a solution:
http://tag.povray.org/povQandT/languageQandT.html#cylindricalrepeat
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks for getting back to me with a complete answer. The immediate things I
notice are these:
POV has no mechanism for painting 2D text on to a surface. There are all kinza
ways to paint patterns and pre-made images on to surfaces, but no way to lay
down simple 2D text. This seems like a major flaw to me.
There is a very limited set of string manipulation and calculation functions
available withing POV script. For instance, the book mentions strlen in talking
about other string functions, but strlen itself isn't available. This would be
very helpful in figuring out how to position text without a lot of trial and
error. Heavy accent on the error.
The book references you gave me don't point to anything. My POV for Windows
(3.6.1) help file goes up to 3.4.9, but you mention sections 3.4.11 and 12. The
online help is even worse, since Chapter 3 is the reference in the help file,
but it's about windows in the online docs.
How do I find more info?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Marty Schrader <mar### [at] parsecsystemsinc com> wrote:
> POV has no mechanism for painting 2D text on to a surface. There are all kinza
> ways to paint patterns and pre-made images on to surfaces, but no way to lay
> down simple 2D text. This seems like a major flaw to me.
Can you give us an example of some pattern which you can apply to a
surface in a way that you cannot apply a text pattern in the same way?
> There is a very limited set of string manipulation and calculation functions
> available withing POV script. For instance, the book mentions strlen in talking
> about other string functions, but strlen itself isn't available. This would be
> very helpful in figuring out how to position text without a lot of trial and
> error. Heavy accent on the error.
Functions are classified by their return value type, not by the parameter
type. strlen() is in the float functions section because it returns a float.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Thorsten Froehlich
Subject: Re: Simple 2D text on a cylinder's surface
Date: 13 Oct 2007 17:06:48
Message: <47113368$1@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Marty Schrader wrote:
> The book references you gave me don't point to anything. My POV for
> Windows (3.6.1) help file goes up to 3.4.9, but you mention sections
> 3.4.11 and 12. The online help is even worse, since Chapter 3 is the
> reference in the help file, but it's about windows in the online docs.
The first number denotes a "book" not a "chapter". Since there are three
platform specific "books", but the online help cannot have three "books"
with the same number (yet it makes the most sense to have platform docs
first), the order is different, the actual chapter numbers are identical though.
Thorsten, POV-Team
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Thorsten Froehlich" <tho### [at] trf de> a écrit dans le message de news:
47113368$1@news.povray.org...
> Marty Schrader wrote:
>> The book references you gave me don't point to anything. My POV for
>> Windows (3.6.1) help file goes up to 3.4.9, but you mention sections
>> 3.4.11 and 12. The online help is even worse, since Chapter 3 is the
>> reference in the help file, but it's about windows in the online docs.
>
> The first number denotes a "book" not a "chapter". Since there are three
> platform specific "books", but the online help cannot have three "books"
> with the same number (yet it makes the most sense to have platform docs
> first), the order is different, the actual chapter numbers are identical
> though.
>
> Thorsten, POV-Team
I wonder how many dried frog pills were swallowed to keep that cool ;-)
Marc
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks for the heads up on strlen().
A "text pattern"? Okay, see, this is the part that kills me. What I wish to do
is paint some simple, flat, non-complex text on to the surface of some object.
This would seem to be a fairly common operation and one which would seem to call
for its own painting mechanism. I see quite a few requests for help on this
subject here on this group and in some of the other POV groups.
What you are telling me is that I need to create a complex 3D object and
manipulate it all over the place in order to paint 2D text. I gotta take a 3D
object and slice it off with an implied intersection to make a 2D pattern, which
I can then use to...Oy!
Not only that, but my experiments so far indicate that the positioning of the
text on the cylinder's surface will be a matter of much hassle and fudging.
Apparently there is no other way. Perhaps it would be smarter to create text as
an external graphic and lay that down with one of the other methods.
By the way, strlen() returns a float? I have only been doing this C stuff for 25
years or so, but a float?!? And in the last 32 years I can't recall coming
across any language spec where the builtins were index by their return type as
opposed to the operational group to which they belonged. String length is
related to strings. And the length should be a character count instead of some
graphic index, eh? Perhaps a different name, like <float> StringGraphicLength()
or something.
Thanks for all the help, guys. I think I am at an impasse here. Gonna hafta use
a JPEG image for my text. Easier.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Heh, heh. It's amazing that somebody can apologize for how screwed up something
is and still make it sound as if it's your fault for not reading the FAQ or
whatever. Hey, I'm not gonna whine too loudly. As long as I can find the data
I'm golden.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> What you are telling me is that I need to create a complex 3D object and
> manipulate it all over the place in order to paint 2D text. I gotta take a
> 3D object and slice it off with an implied intersection to make a 2D
> pattern, which I can then use to...Oy!
The typical method that I use for this sort of thing is to use image_maps.
It seems perty straight-forward to me, I wouldn't say that lack of a text
pattern makes much difference, either way you'll end up having to scale
the resulting words pigment to look right.
The text object, and the object pattern are handy in some cases,
but they are not replacements for layered textures.
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Samuel Benge
Subject: Re: Simple 2D text on a cylinder's surface
Date: 13 Oct 2007 21:25:25
Message: <47117005@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Marty Schrader wrote:
> Heh, heh. It's amazing that somebody can apologize for how screwed up
> something is and still make it sound as if it's your fault for not
> reading the FAQ or whatever. Hey, I'm not gonna whine too loudly. As
> long as I can find the data I'm golden.
Those of us who know how to manipulate POV into something useful have
been working with it for a long time. We are insanely dedicated to
learning something we love doing.
If you want easy answers, you must look into your own mind. Since I've
been using POV for quite a while now, those 'easy' answers are there for
quick retrieval, in my own mind.
If you want a simpler way to do things, spend some cash on a program
which makes it *really* easy.
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Sherry Shaw
Subject: Re: Simple 2D text on a cylinder's surface
Date: 13 Oct 2007 23:18:53
Message: <47118a9d@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Marty Schrader wrote:
> For instance, the book mentions
> strlen in talking about other string functions, but strlen itself isn't
> available.
You're reading the Help file, right? Click the "Index" tab. Type
"strlen" in the box. Son of a gun, there it is.
> This would be very helpful in figuring out how to position
> text without a lot of trial and error.
Actually, unless you're using a fixed-width font, you probably want
min_extent and max_extent for that.
> Heavy accent on the error.
Practice makes perfect.
--Sherry Shaw
--
#macro T(E,N)sphere{x,.4rotate z*E*60translate y*N pigment{wrinkles scale
.3}finish{ambient 1}}#end#local I=0;#while(I<5)T(I,1)T(1-I,-1)#local I=I+
1;#end camera{location-5*z}plane{z,37 pigment{granite color_map{[.7rgb 0]
[1rgb 1]}}finish{ambient 2}}// TenMoons
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Marty Schrader <mar### [at] parsecsystemsinc com> wrote:
> What you are telling me is that I need to create a complex 3D object and
> manipulate it all over the place in order to paint 2D text. I gotta take a 3D
> object and slice it off with an implied intersection to make a 2D pattern, which
> I can then use to...Oy!
No. I already gave you the solution in my other post (using the object
pattern). Perhaps you didn't read it? It's here:
http://tag.povray.org/povQandT/languageQandT.html#cylindricalrepeat
> By the way, strlen() returns a float? I have only been doing this C stuff for 25
> years or so, but a float?!?
POV-Ray doesn't have integers. All numerical values are floats. Hence
strlen() returns a float (even though the value of this float will always
be an integer).
> And in the last 32 years I can't recall coming
> across any language spec where the builtins were index by their return type as
> opposed to the operational group to which they belonged.
Well, the POV-Ray documentation classifies the functions by their
return value type. It's a simple way of classifying them.
> And the length should be a character count instead of some
> graphic index, eh?
strlen() returns the character count.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Thorsten Froehlich
Subject: Re: Simple 2D text on a cylinder's surface
Date: 14 Oct 2007 05:10:41
Message: <4711dd11$1@news.povray.org>
|
|
 |
|  |
|  |
|
 |
M_a_r_c wrote:
> "Thorsten Froehlich" <tho### [at] trf de> a écrit dans le message de news:
> 47113368$1@news.povray.org...
>> Marty Schrader wrote:
>>> The book references you gave me don't point to anything. My POV for
>>> Windows (3.6.1) help file goes up to 3.4.9, but you mention sections
>>> 3.4.11 and 12. The online help is even worse, since Chapter 3 is the
>>> reference in the help file, but it's about windows in the online docs.
>> The first number denotes a "book" not a "chapter". Since there are three
>> platform specific "books", but the online help cannot have three "books"
>> with the same number (yet it makes the most sense to have platform docs
>> first), the order is different, the actual chapter numbers are identical
>> though.
>>
>> Thorsten, POV-Team
>
> I wonder how many dried frog pills were swallowed to keep that cool ;-)
LOL, eventually we should replace the first number with a unique letter (or
drop it altogether), then the complexity will go away :-)
Thorsten
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Samuel Benge <stb### [at] THIShotmail com> wrote:
> Marty Schrader wrote:
> > This subject has been beaten to death on this group, but to no
> > satisfactory conclusion.
>
> Here you go, Marty:
>
Hey Samuel can you tell me why I loose part of the first few characters?
see code below
Leef_me
camera {
// orthographic
location <0,0,-10.5> look_at <0,0,0>
}
light_source { <-10,-7,-40> color rgb 1}
light_source { <1,0,-1.5> color rgb 1}
// Create an infinite sphere around scene and allow any pigment on it
sky_sphere {
pigment {
gradient y
color_map { [0.0 color rgb <0.7,0.7,1.0>] [1.0 color blue 0.5] }
}
}
// using text as a pigment on a plane, original code was in response to text
on a cylinder
//From: Samuel Benge
//Subject: Re: Simple 2D text on a cylinder's surface
//Date: 12 Oct 2007 06:39:40
// begin code
#declare my_text=
text{
ttf"arialbd.ttf"
"Test"
1,0
// translate<1.5,0,0>
}
//**********************************************
//
// Why is part of the first character or two lost?
//
//**********************************************
// flat circular FINITE (no CSG) shape, center hole cutout is optional
disc {
<0, 0, 0> // center position
z, // normal vector
5.0, // outer radius
//0.2 // optional hole radius
pigment{
pigment_pattern{
object{my_text 0,1}
// translate<1.5,0,0>
}
}
}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Leef_me wrote:
> Hey Samuel can you tell me why I loose part of the first few characters?
> see code below
>
> Leef_me
Yes, you are experiencing that old problematic artifact known as
coincident surfaces. The front of the text object occupies the exact
same space as the surface of the disc. Since the text object is 1 unit
deep, change it to this:
#declare my_text=
text{
ttf"arialbd.ttf"
"Test"
1,0
translate -z/2
}
Doing that will allow the text object to intersect the disc correctly,
thus displaying all of the text.
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Samuel Benge <stb### [at] THIShotmail com> wrote:
> Leef_me wrote:
> > Hey Samuel can you tell me why I loose part of the first few characters?
> > see code below
> >
> > Leef_me
>
> Yes, you are experiencing that old problematic artifact known as
> coincident surfaces. The front of the text object occupies the exact
> same space as the surface of the disc. Since the text object is 1 unit
> deep, change it to this:
>
> #declare my_text=
> text{
> ttf"arialbd.ttf"
> "Test"
> 1,0
> translate -z/2
> }
>
> Doing that will allow the text object to intersect the disc correctly,
> thus displaying all of the text.
>
> Sam
That does indeed <solved> the problem. And in understand the concept of
coincident surfaces. I failed to try translating the text in that axis.
I have experienced coincident surfaces as a random pixelation between the
two surfaces.
What I don't understand and what really through me was that it wasn't the
whole string. Just the top left at the start of the string was cut off at
an angle.
Thanks for the solution, now I start to comprehend the code.
Leef_me
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Samuel Benge
Subject: Re: Simple 2D text on a cylinder's surface
Date: 21 Oct 2007 16:39:07
Message: <471bb8eb@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Leef_me wrote:
> That does indeed <solved> the problem. And in understand the concept of
> coincident surfaces. I failed to try translating the text in that axis.
> I have experienced coincident surfaces as a random pixelation between the
> two surfaces.
>
> What I don't understand and what really through me was that it wasn't the
> whole string. Just the top left at the start of the string was cut off at
> an angle.
Yeah, you would expect the same random pixelation to occur, not the
strange angled cut. It seems to be due to how POV handles object
pigments. I'm getting the same effect with every flat object I try.
> Thanks for the solution, now I start to comprehend the code.
You're welcome. It's nice to see somebody passing through a difficult
problem :)
If you *really* want to make sure it never happens again, you can make
the object pigment infinitely long in the z-axis by changing your object
pigment like so:
pigment_pattern{
object{my_text 0,1}
translate<1.5,0,0>
warp{planar}
}
As long as you made the first 'translate' in the text object's
definition, this should work just fine.
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Samuel Benge <stb### [at] THIShotmail com> wrote:
> Leef_me wrote:
> > That does indeed <solved> the problem. And in understand the concept of
> If you *really* want to make sure it never happens again, you can make
> the object pigment infinitely long in the z-axis by changing your object
> pigment like so:
>
> pigment_pattern{
> object{my_text 0,1}
> translate<1.5,0,0>
> warp{planar}
> }
>
> As long as you made the first 'translate' in the text object's
> definition, this should work just fine.
>
> Sam
Ok, that works as advertised. But I stumbled upon a new wrinkle.
I want to apply the 2D text to a flat object: disc, plane, sheet of paper,
or im my case a mesh.
(I'm looking the the scroll object at
http://lib.povray.org/searchcollection/index.php }
I've even succeeded in getting the text to run cross-wise or along the
length of the scroll. No code to share yey, it is very rough. Problem is
that the text 'bleeds through' and is visible from both sides of the
object.
Is there some way to apply a pigment to the 2D text and a different pigment
to the surrounding area including the opposite side, or maybe even a 3rd
pigment to the opposite side alone?
Leef_me
Post a reply to this message
|
 |
|  |
|  |
|
 |
From: Samuel Benge
Subject: Re: Simple 2D text on a cylinder's surface
Date: 23 Oct 2007 17:42:19
Message: <471e6abb@news.povray.org>
|
|
 |
|  |
|  |
|
 |
Leef_me wrote:
> Ok, that works as advertised. But I stumbled upon a new wrinkle.
>
> I want to apply the 2D text to a flat object: disc, plane, sheet of paper,
> or im my case a mesh.
> (I'm looking the the scroll object at
> http://lib.povray.org/searchcollection/index.php }
>
> I've even succeeded in getting the text to run cross-wise or along the
> length of the scroll.
Good work!
> No code to share yey, it is very rough. Problem is
> that the text 'bleeds through' and is visible from both sides of the
> object.
>
> Is there some way to apply a pigment to the 2D text and a different pigment
> to the surrounding area including the opposite side, or maybe even a 3rd
> pigment to the opposite side alone?
>
> Leef_me
Not having used the scroll object, I cannot say for certain if this will
work with it. You may want to try interior_texture. Since objects in POV
have two sides (inside, outside), there is a provision for texturing
both sides separately.
Try something like this:
object{ my_object
texture{
pigment{ my_text_pigment }
}
interior_texture{
pigment{ no_text_pigment }
}
}
Sam
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Not having used the scroll object, I cannot say for certain if this will
> work with it. You may want to try interior_texture. Since objects in POV
> have two sides (inside, outside), there is a provision for texturing both
> sides separately.
>
> Try something like this:
>
> object{ my_object
> texture{
> pigment{ my_text_pigment }
> }
> interior_texture{
> pigment{ no_text_pigment }
> }
> }
This should work fine, the scroll is a surface without a
clearly defined inside... the back is the interior_texture.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Tim Attwood" <tim### [at] comcast net> wrote:
> > Not having used the scroll object, I cannot say for certain if this will
> > work with it. You may want to try interior_texture. Since objects in POV
> > have two sides (inside, outside), there is a provision for texturing both
> > sides separately.
> >
> > Try something like this:
> >
> > object{ my_object
> > texture{
> > pigment{ my_text_pigment }
> > }
> > interior_texture{
> > pigment{ no_text_pigment }
> > }
> > }
>
> This should work fine, the scroll is a surface without a
> clearly defined inside... the back is the interior_texture.
Thanks Sam and Tim, and also to Gregjohn for his original question
I found out about interior_texture a little while ago by reading and
experiments
I found that I had to use keyword uv_mapping or the text was pixelated as
before
For anyone else, here is an example of a disc with text and background on
one side and background only on the other side
#declare my_text= text{ ttf"arialbd.ttf" "This is a test" 1,0
translate -z/2
// suggested by fellow pover Samuel Benge Date: 21 Oct 2007 20:39:07
// Re: Simple 2D text on a cylinder's surface
scale .2
//rotate <0,0,90>
translate<-.7,0,0>
// when the Z rotation is 90, then these parameters are y,x,z
// when the Z rotation is 0, then these parameters are x,y,z
}
disc {
<0, 0, 0> // center position
y, // normal vector
1.0, // outer radius
uv_mapping
texture { // one side has background and text
pigment{
pigment_pattern{
object{my_text 0,1}
}
pigment_map{
[0 color Black]
[1 color White]
}
}
}
interior_texture { // the other side has another background
pigment {
color Blue
}
}
rotate x*-45
rotate x*90*clock // look at both sides of the disc
}
Leef_me
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
This appears to be the solution I will have to employ. My original intent was to
make use of POV-Ray as a very low (like, zero) cost solution for a complex and
tedious problem. However, POV itself has turned out to be a complex and tedious
system that has more flaws and shortcomings than the manual solution provided by
other tools.
So, it's back to Google to shop for 3D design tools that won't bust the budget.
Thanks for all the help, folks. See you around.
--
Marty Schrader
Embedded Technology Consulting from
Parsec Systems, Inc.
0N107 Cottonwood Drive
Wheaton, IL 60187
(630) 588-0241
www.parsecsystemsinc.com
mar### [at] parsecsystemsinc com
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |