|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I want to map a pattern, either a checkerboard texture, or an input image,
onto a cylinder. What I want to do is take a square image and repeatedly
"paint" or "tile" it on the cylinder.
I've tried this:
cylinder { <0, -1, 0>, <0 1 0>, 1
texture {
pigment {
image_map { gif "myimage.gif" map_type 2 interpolate 2 }
}
}
}
but how do I make the aspect ratio so that a 1x1 patch on the surface of
the cylinder gets the image I input?
Also, can I make default textures, like "checker" paint in the same way?
Thanks for any help,
Richard
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Richard who wrote:
>I want to map a pattern, either a checkerboard texture, or an input image,
>onto a cylinder. What I want to do is take a square image and repeatedly
>"paint" or "tile" it on the cylinder.
>
>I've tried this:
>
>cylinder { <0, -1, 0>, <0 1 0>, 1
> texture {
> pigment {
> image_map { gif "myimage.gif" map_type 2 interpolate 2 }
> }
> }
>}
>
>but how do I make the aspect ratio so that a 1x1 patch on the surface of
>the cylinder gets the image I input?
In the case of a cylinder, you can use uv_mapping
cylinder { <0, -1, 0>, <0 1 0>, 1
uv_mapping
texture {
pigment {
image_map {
gif "myimage.gif"
interpolate 2
}
}
}
}
>
>Also, can I make default textures, like "checker" paint in the same way?
And uv_mapping also works for any texture
cylinder { <0, -1, 0>, <0 1 0>, 1
uv_mapping
pigment {
checker scale 0.5
}
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams wrote:
>Wasn't it Richard who wrote:
>>I want to map a pattern, either a checkerboard texture, or an input image,
>>onto a cylinder. What I want to do is take a square image and repeatedly
>>"paint" or "tile" it on the cylinder.
>>
>>I've tried this:
>>
>>cylinder { <0, -1, 0>, <0 1 0>, 1
>> texture {
>> pigment {
>> image_map { gif "myimage.gif" map_type 2 interpolate 2 }
>> }
>> }
>>}
>>
>>but how do I make the aspect ratio so that a 1x1 patch on the surface of
>>the cylinder gets the image I input?
>
>In the case of a cylinder, you can use uv_mapping
>
>cylinder { <0, -1, 0>, <0 1 0>, 1
> uv_mapping
> texture {
> pigment {
> image_map {
> gif "myimage.gif"
> interpolate 2
> }
> }
> }
>}
>
>
>>
>>Also, can I make default textures, like "checker" paint in the same way?
>
>And uv_mapping also works for any texture
>
>cylinder { <0, -1, 0>, <0 1 0>, 1
> uv_mapping
> pigment {
> checker scale 0.5
> }
>}
>
>Mike Williams
>Gentleman of Leisure
>
Thanks for the suggestion. But uv_mapping doesn't seem to work for
cylinders!
Here is the closest I could get, using "lathe" objects:
lathe {
linear_spline
2, <3, 0>, <3, 5> // radius 3, height 5
uv_mapping
texture {
pigment {
image_map {
gif "myimage.gif"
interpolate 2
}
}
finish { ambient 1.0 }
scale <0.50, 1.0> // make texture map isotropic on surface
// needed because both inside and outside of cylinder
// are painted
}
}
I tried a "sor" object, but couldn't get it to work. I don't understand
what the first and last values do in the sor. Does anyone know how to
draw a cylinder, without end covers?
Thanks again,
Richard
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Wasn't it Richard who wrote:
>Thanks for the suggestion. But uv_mapping doesn't seem to work for
>cylinders!
It works for me.
#declare SCALE=<3,2.5,3>;
cylinder { <0, -1, 0>, <0 1 0>, 1
open
uv_mapping
texture {
pigment {
image_map {
gif "myimage.gif"
interpolate 2
}
}
finish { ambient 1.0 }
scale SCALE*2 // make texture map isotropic on surface
// needed because both inside and outside of cylinder
// are painted
}
scale SCALE // radius 3, height 5
translate <6,2.5,0>
}
>I tried a "sor" object, but couldn't get it to work. I don't understand
>what the first and last values do in the sor. Does anyone know how to
>draw a cylinder, without end covers?
The start and end points of a SOR are a bit like the extra points you
need for a cubic_spline. I don't think that it's documented what sort of
spline is actually used for generating a SOR, but it's definitely not a
linear spline. To create the appearance of a linear spline with a SOR,
you can simply double up the end points.
To remove the end covers, use the "open" keyword, just like with
"cylinder".
sor {
4, <3, 0>,<3, 0>,<3, 5>,<3, 5> open // radius 3, height 5
uv_mapping
texture {
pigment {
image_map {
gif "myimage.gif"
interpolate 2
}
}
finish { ambient 1.0 }
scale <0.50, 1.0> // make texture map isotropic on surface
// needed because both inside and outside of cylinder
// are painted
}
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|
| |
| |
|
|
From:
Subject: Re: *repeated* texture map (image or checkerboard) on cylinder?
Date: 18 Dec 2003 06:12:46
Message: <3fe18bae@news.povray.org>
|
|
|
| |
| |
|
|
// Hi Richard,
//
// here is a complete scene showing a scalable
// cylindrical map using a warp.
//
// Sputnik
// -F +A0.1 +AM2 +R2 +W512 +H384
#declare High = 5; // number of stacked images
#declare Around =10; // number of images around a circumference
#declare Width = 0.4; // width of a single image-patch
#declare Height = 0.3; // height of a single image-patch
#declare MyRadius = 0.4; // (see below)
#declare Radius = Around*Width/2/pi; // calculate Radius from circumference
#declare Length = High*Height; // calculate Length
cylinder { 0, Length*y, Radius
pigment {
image_map {
png "C:\Programs\POV-Ray for Windows v3.5\include\bumpmap_.png"
//once // only 1 image with lower left corner at Radius*x
map_type 0 // planar map!; wrapping is done by warp
interpolate 2
}
// checker {...} instead of image_map {...} works too
// put Around X High images onto 1 X Length
scale <1/Around, Height, 1>
warp {
// wrap around a cylinder: 1 X Length -> circumference X Length
cylindrical
// look onto the image's xy-plane
orientation z
dist_exp 0
}
}
finish { ambient 1 }
//scale MyRadius/Radius // makes a cylinder with radius=MyRadius (and
// proportionally corrected length)
}
// never without checkered plane and sphere ...
plane { y, -0.01 pigment { checker } finish { ambient 1 } }
sphere { Radius*x, Radius/10
pigment { color red 2 }
finish { ambient 1 }
//scale MyRadius/Radius // corresponds to the cylinder's scale
}
camera { location 0.4*<2, 3, -4> look_at 0 translate Length/2*y }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mike Williams wrote:
>Wasn't it Richard who wrote:
>
>>Thanks for the suggestion. But uv_mapping doesn't seem to work for
>>cylinders!
>
>It works for me.
>
>#declare SCALE=<3,2.5,3>;
>
>cylinder { <0, -1, 0>, <0 1 0>, 1
> open
> uv_mapping
> texture {
> pigment {
> image_map {
> gif "myimage.gif"
> interpolate 2
> }
> }
> finish { ambient 1.0 }
> scale SCALE*2 // make texture map isotropic on surface
> // needed because both inside and outside of cylinder
> // are painted
> }
> scale SCALE // radius 3, height 5
> translate <6,2.5,0>
>}
>
>>I tried a "sor" object, but couldn't get it to work. I don't understand
>>what the first and last values do in the sor. Does anyone know how to
>>draw a cylinder, without end covers?
>
>The start and end points of a SOR are a bit like the extra points you
>need for a cubic_spline. I don't think that it's documented what sort of
>spline is actually used for generating a SOR, but it's definitely not a
>linear spline. To create the appearance of a linear spline with a SOR,
>you can simply double up the end points.
>
>To remove the end covers, use the "open" keyword, just like with
>"cylinder".
>
>sor {
> 4, <3, 0>,<3, 0>,<3, 5>,<3, 5> open // radius 3, height 5
> uv_mapping
> texture {
> pigment {
> image_map {
> gif "myimage.gif"
> interpolate 2
> }
> }
> finish { ambient 1.0 }
> scale <0.50, 1.0> // make texture map isotropic on surface
> // needed because both inside and outside of cylinder
> // are painted
> }
>}
>
>Mike Williams
>Gentleman of Leisure
>
Thanks for all the help (to Mike and others).
Here is an image, but it doesn't map checkers _uniformly_ over the surface
of
the cylinder. Is this a problem with my version (3.5)?
// BEGIN
camera {
angle 60
location <20 20 -10>
look_at <0, 0, 0>
}
cylinder { <0, -5, 0>, <0 5 0>, 3
open
uv_mapping
pigment {
checker scale 0.5
}
finish { ambient 1.0 }
}
// END
Otherwise I'll use "sor" or "lathe", or the "warp" function the other
poster suggested.
Thanks,
Richard
Post a reply to this message
|
|
| |
| |
|
|
From:
Subject: Re: *repeated* texture map (image or checkerboard) on cylinder?
Date: 19 Dec 2003 20:28:15
Message: <3fe3a5af$1@news.povray.org>
|
|
|
| |
| |
|
|
// Hi Richard,
//
// rereading the doc (6.7.7 UV Mapping; 6.7.7.1 Supported Objects) I
// realized that cylinders don't have an uv-mapping adapted to them.
// POV-Ray doesn't complain -- planar mapping (using the xy-plane at
// z=0, projected along the z-axis) seems to be used instead. So warp
// probably is the best method (or make a cylinder with lathe or sor).
//
// Below you will again find a little scene, this time without cylinder
// caps and with an interior texture added (partially transparent: sort
// of one-way transparency!).
// Because the backslash has a special meaning inside strings, it has
// to be denoted by "\\" -- I've corrected this in the string which
// describes the path to the images.
//
// Sputnik
//
//
// P.S. POV-Ray doesn't recognize your intended camera location
// <20 20 -10>, this is read as <20 20-10>, giving <20, 10>
// which is expanded to <20, 10, 0>.
// See 6.1.4.1 Vector Literals and 6.1.4.4 Operator Promotion.
// -F +A0.1 +AM2 +R2 +W512 +H384
#declare PicPath = "C:\\Programs\\POV-Ray for Windows v3.5\\include\\"
#declare OuterPic = "bumpmap_.png"
#declare InnerPic = "povmap.png"
#declare High = 5; // number of stacked images
#declare Around =10; // number of images around a circumference
#declare Width = 0.4; // width of a single image-patch
#declare Height = 0.3; // height of a single image-patch
#declare MyRadius = 0.4; // (see below)
#declare Radius = Around*Width/2/pi; // calculate Radius from circumference
#declare Length = High*Height; // calculate Length
cylinder { 0, Length*y, Radius open
pigment {
image_map {
png OuterPic
//once // only 1 image with lower left corner at Radius*x
map_type 0 // planar map!; wrapping is done by warp
interpolate 2
}
// checker {...} instead of image_map {...} works too
// put Around X High images onto 1 X Length
scale <1/Around, Height, 1>
warp {
// wrap around a cylinder: 1 X Length -> circumference X Length
cylindrical
// look onto the image's xy-plane
orientation z
dist_exp 0
}
}
finish { ambient 1 }
interior_texture {
pigment {
image_map { png InnerPic map_type 0 interpolate 2 }
scale <-1/Around, Height, 1> // "-" gives mirror image
translate x // this puts the mirror image back to <0,0>, <1,1>
warp { cylindrical orientation z dist_exp 0 }
}
finish { ambient 1 }
}
//scale MyRadius/Radius // makes a cylinder with radius=MyRadius (and
// proportionally corrected length)
}
// never without checkered plane and sphere ...
plane { y, -0.01 pigment { checker } finish { ambient 1 } }
sphere { Radius*x, Radius/10
pigment { color red 2 }
finish { ambient 1 }
//scale MyRadius/Radius // corresponds to the cylinder's scale
}
camera { location 0.4*<2, 3, -4> look_at 0 translate Length/2*y }
// END //
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|