|
|
|
|
|
|
| |
| |
|
|
From: Rick DeNatale
Subject: image map on cone - help me understand
Date: 11 Oct 2005 17:21:51
Message: <434c2cef@news.povray.org>
|
|
|
| |
| |
|
|
I'm modeling a Mercury spacecraft, and I'm trying to use an image map
for some markings like the words UNITED/STATES and the American flag.
The main cabin of the spacecraft which I'm trying to texture with an
image_map is a truncated cone with an included angle of 40 degrees (or
another way of saying this is that the sides are 20 degrees from the
vertical. Because of the drawings I'm using the cone is centered on the
Z axis.
The particular markings I'm starting with a the words UNITED and STATES
vertically stacked with a small flag underneath. The tops and bottoms
of each word and the flag run along the circles defined by the
intersection of the cone and planes parallel to the X-Y plane. The
sides lie on lines which run from the apex of the cone (if it were not
truncated), to the base of the cone.
So right now I've got something like this:
#declare ConeTopRadius = 16;
#declare ConeBotRadius = 37.25;
#declare ConeTopZ = 161.71;
#declare ConeBotZ = 103.18;
#declare CabinCone = {
Cone {
<0,0,ConeBotZ>, ConeTopRadius,
<0,0,ConeTopZ>, ConeBotRadius
}
}
#declare Cabin = object {
object { CabinCone }
texture { ReneMetal }
texture {
pigment {
image_map {
png "maps/testmap.png"
map_type_2 // cylindrical map
once
scale <1, ConeTopZ-ConeBotZ,1>
rotate x*90 // put it concentric with the cone
translate z*ConeBotZ
}
}
}
}
The png is transparent with just the words and the flag with the words
laid out normally. I didn't go to great pains to make the aspect ratio
of the image "correct" whatever that is, it's roughly the height of the
truncated cone to the large circumference.
The effect I'm getting is just the opposite of what I want, the tops of
the words and flag are wider than the bottom rather than narrower which
is what I want. I don't understand how the image is being projected
onto the cone well enough to understand what I'm seeing. I got the
scaling above by playing,
I'm guessing that I'm going to somehow distort the original png image by
keystoning parts, or is there a better way to accomplish what I want?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Rick DeNatale" <ric### [at] denhaven2com> wrote in message
news:434c2cef@news.povray.org...
> I'm modeling a Mercury spacecraft, and I'm trying to use an image map
> for some markings like the words UNITED/STATES and the American flag.
>
> The main cabin of the spacecraft which I'm trying to texture with an
> image_map is a truncated cone with an included angle of 40 degrees (or
> another way of saying this is that the sides are 20 degrees from the
> vertical. Because of the drawings I'm using the cone is centered on the
> Z axis.
>
> The particular markings I'm starting with a the words UNITED and STATES
> vertically stacked with a small flag underneath. The tops and bottoms
> of each word and the flag run along the circles defined by the
> intersection of the cone and planes parallel to the X-Y plane. The
> sides lie on lines which run from the apex of the cone (if it were not
> truncated), to the base of the cone.
>
> So right now I've got something like this:
>
> #declare ConeTopRadius = 16;
> #declare ConeBotRadius = 37.25;
> #declare ConeTopZ = 161.71;
> #declare ConeBotZ = 103.18;
>
> #declare CabinCone = {
> Cone {
> <0,0,ConeBotZ>, ConeTopRadius,
> <0,0,ConeTopZ>, ConeBotRadius
> }
> }
>
> #declare Cabin = object {
> object { CabinCone }
> texture { ReneMetal }
> texture {
> pigment {
> image_map {
> png "maps/testmap.png"
> map_type_2 // cylindrical map
> once
> scale <1, ConeTopZ-ConeBotZ,1>
> rotate x*90 // put it concentric with the cone
> translate z*ConeBotZ
> }
> }
> }
> }
>
> The png is transparent with just the words and the flag with the words
> laid out normally. I didn't go to great pains to make the aspect ratio
> of the image "correct" whatever that is, it's roughly the height of the
> truncated cone to the large circumference.
>
> The effect I'm getting is just the opposite of what I want, the tops of
> the words and flag are wider than the bottom rather than narrower which
> is what I want. I don't understand how the image is being projected
> onto the cone well enough to understand what I'm seeing. I got the
> scaling above by playing,
>
> I'm guessing that I'm going to somehow distort the original png image by
> keystoning parts, or is there a better way to accomplish what I want?
If the image only needs to wrap around the cone for a short way then you
could align the cylindrical mapping with the edge of the cone rather than
its central axis. Assuming the flag and text are roughly in the centre of
the image you would need to rotate -90 degrees around y then 70 degrees
around x to place the text on the top surface of your cone. This places the
writing approximately parallel with the conical surface for a short stretch.
This will obviously distort too much if you need to wrap the image around
more than about 30 percent of the circumference of the cone.
To get text wrapping right the way round the cone you could look at using a
text object as a pigment. You could create a texture for each letter and
orient each letter so that it's parallel to the surface of the cone at the
position you want. Here's an example:
light_source { < 0, 1000 ,-30> color rgb 1 }
camera {location <0,100,50> look_at <0,0,150>}
#declare ConeTopRadius = 37.25;
#declare ConeBotRadius = 16;
#declare ConeTopZ = 161.71;
#declare ConeBotZ = 103.18;
#declare Apex = (ConeTopZ-ConeBotZ)*ConeBotRadius/
(ConeTopRadius-ConeBotRadius);
#declare CabinCone = cone {
<0,0,ConeBotZ>, ConeBotRadius,
<0,0,ConeTopZ>, ConeTopRadius
}
#declare Cabin = object {
CabinCone
texture { pigment {color rgb <1,1,1>} }
texture {
pigment {
object {
text {ttf "arial.ttf" "E" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+40)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate z*20
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "S" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+40)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate z*0
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "A" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+40)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate -z*20
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "/" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+30)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate z*0
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "R" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+20)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate z*20
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "S" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+20)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate z*0
}
}
texture {
pigment {
object {
text {ttf "arial.ttf" "A" 1, 0}
color rgbt 1
color <1,0,0>
}
translate <-0.3,0,-0.1>
scale 10
translate y*(Apex+20)
rotate x*70
translate z*(ConeBotZ-Apex)
rotate -z*20
}
}
}
object {Cabin}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Chris B wrote:
> To get text wrapping right the way round the cone you could look at using a
> text object as a pigment. You could create a texture for each letter and
> orient each letter so that it's parallel to the surface of the cone at the
> position you want.
Actually I don't think that thats what I want, the letters actually need
to be narrower at the top than at the bottom.
I went back and looked at the png I was using and it wasn't quite right.
On the original spacecraft, the words UNITED and STATES were stacked
over each other and justified, my png had UNITED longer than STATES. I
went back and manually kerned STATES and now it looks better, with the
cylindrical wrap.
I'm still trying to understand just how cylindrical mapping works. The
documentation on map_types leaves some "exercises to the reader". Here's
how I think it works. To simplify things, I'm going to wrap the map
around a cone centered on the y-axis say cone { <0,bot,0>, r1,
<0,top,0>, r2 }
Please let me know if I've got any of this wrong:
1. The bit map is wrapped around a 1 unit high cylinder around the
y-axis, with the bottom at y=0 and the top at y=1. The bottom left edge
of the map is on the x-axis, and the map wraps in a -y rotation, with
the right side meeting the left side to form a complete cylinder.
2. To make the cylinder cover the height of the cone, I need to:
scale y*(top-bot)
3. And to align it with the cone I need to
translate y*bot
So I've got:
object {
cone { <0,bot,0>, r1, <0,top,0>, r2 }
pigment {
image_map {
png "myPng.png"
map_type 2 // spherical map
once // prevents the map from repeating VERTICALLY
scale y*(top-bot)
translate y*bot
}
}
}
4. Now to decide the color of a point on the object while I'll call
<Xp,Yp,Zp>. The color will be the color at the closest point where the
line between <Xp,Yp,Zp> and <0,yc,0>. This is why the cylinder can be
"of any diameter".
Another way of looking at this is that the "x" coordinate of a pixel in
the map represents an negative angle of rotation about the y axis, with
the angle in degrees being -360*(mapWidth/x). So if I draw my bitmap(s)
with this coordinate transformation in mind I should be okay. The main
reason I'd need multiple maps would be if I was bothered by the
"Greenland" effect as I got to top or bottom of the bitmap which was at
the narrow end of the cone.
The main difference between a planar, cylindrical, and spherical map
type, besides the "shape transformation of the map in step 1, is that in
a planar map the projection lines in step 4, will be between <Xp,Yp,Zp>
and <Xp,Yp,0>; and for a spherical map between <Xp,Yp,Zp> and <0,0,0>.
At this stage of my learning I'm not going to think much about either
the toroidal mapping nor what happens in the spherical mapping due to
the singularity at the poles of the cylinder.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|