POV-Ray : Newsgroups : povray.newusers : image_map on deformed cylinder Server Time
26 Nov 2024 14:38:25 EST (-0500)
  image_map on deformed cylinder (Message 1 to 4 of 4)  
From: Dr  Doogie
Subject: image_map on deformed cylinder
Date: 28 Apr 2004 14:15:00
Message: <web.408ff3d3352d67047551a730@news.povray.org>
Hi everyone,

I need to map an image on a deformed cylinder (<0,0,0> , <0,1,0>, 25 scale
<0.5, 1, 1.5> )

When i map an image on it, it's not correct. There are mapping imperfections
on the narrowest edges (on the 2 sides where the radius of curvature is at
its lowest). The part of the image mapped on these sides is more stretched
(horizontally) than the rest. (Actually i map an image that features some
number like 123456790 and the 2 that are on the edges are lot more wider
than the others).

Is there a better way to map an image on a deformed cylinder ?

Here an excerpt of my code :

union {
 cylinder { <0, 0, 0>, <0, 1, 0>, 25
  scale <0.5, 1, 1.5>
 }

 texture {
  pigment {
   image_map {
    png "C:\Image.388\mapCylinder.png"
    map_type 2
    interpolate 2

    filter all 0.1
   }
  }
  finish { reflection {0.0} ambient 0.0 diffuse 0.3 }
 }
 scale<1,100,1>
}

Thank you for your help
Dr Doogie


Post a reply to this message

From: Alain
Subject: Re: image_map on deformed cylinder
Date: 28 Apr 2004 18:44:14
Message: <409033be$1@news.povray.org>
Dr. Doogie nous apporta ses lumieres ainsi en ce 2004/04/28 14:11... :

>Hi everyone,
>
>I need to map an image on a deformed cylinder (<0,0,0> , <0,1,0>, 25 scale
><0.5, 1, 1.5> )
>
>When i map an image on it, it's not correct. There are mapping imperfections
>on the narrowest edges (on the 2 sides where the radius of curvature is at
>its lowest). The part of the image mapped on these sides is more stretched
>(horizontally) than the rest. (Actually i map an image that features some
>number like 123456790 and the 2 that are on the edges are lot more wider
>than the others).
>
>Is there a better way to map an image on a deformed cylinder ?
>
>Here an excerpt of my code :
>
>union {
> cylinder { <0, 0, 0>, <0, 1, 0>, 25
>  scale <0.5, 1, 1.5>
> }
>
> texture {
>  pigment {
>   image_map {
>    png "C:\Image.388\mapCylinder.png"
>    map_type 2
>    interpolate 2
>
>    filter all 0.1
>   }
>  }
>  finish { reflection {0.0} ambient 0.0 diffuse 0.3 }
> }
> scale<1,100,1>
>}
>
>Thank you for your help
>Dr Doogie
>
>  
>
You use cylindrical maping, so, the image is applied acording to the 
*angle* to a solid from whitch the deformed cylinder is carved out. At 
the narrow parts, the image get stretched. Thats the why of your problem.
The cure to it:
Solution one: distord your image to compensate. Limits: ONLY works in 
that particular case, is you rotate the image around the object, the 
distortion will get worst.
Solution two: Use UV-Maping. That way, the image will follow any 
deformation you may inflict to your cylinder.
Solution tree: Apply the texture before you scale the cylinder. You may 
still see some distortions.

Alain


Post a reply to this message

From: Christopher James Huff
Subject: Re: image_map on deformed cylinder
Date: 28 Apr 2004 20:27:46
Message: <cjameshuff-0774D6.20264728042004@news.povray.org>
In article <409033be$1@news.povray.org>, Alain <aze### [at] qwertygov> 
wrote:

> Solution two: Use UV-Maping. That way, the image will follow any 
> deformation you may inflict to your cylinder.
> Solution tree: Apply the texture before you scale the cylinder. You may 
> still see some distortions.

These two should give exactly the same results. If the texture is 
applied to the cylinder before scaling, it will get scaled along with 
the cylinder in exactly the same way. The texture at a point on the 
cylinder will match exactly with it's corresponding point on the 
deformed cylinder.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Mike Williams
Subject: Re: image_map on deformed cylinder
Date: 29 Apr 2004 01:05:20
Message: <zy4gSAAPPEkAFw+d@econym.demon.co.uk>
Wasn't it Dr. Doogie who wrote:
>Hi everyone,
>
>I need to map an image on a deformed cylinder (<0,0,0> , <0,1,0>, 25 scale
><0.5, 1, 1.5> )
>
>When i map an image on it, it's not correct. There are mapping imperfections
>on the narrowest edges (on the 2 sides where the radius of curvature is at
>its lowest). The part of the image mapped on these sides is more stretched
>(horizontally) than the rest. (Actually i map an image that features some
>number like 123456790 and the 2 that are on the edges are lot more wider
>than the others).
>
>Is there a better way to map an image on a deformed cylinder ?

Try moving the "scale <0.5, 1, 1.5>" out of the cylinder section and
down next to the "scale <1,100,1>" so that it scales the texture as well
as the cylinder.

I imagine that that might push things too far for what you're trying to
achieve, so you'll need to find a happy medium, scaling by something
inside the cylinder section and then by something else after the
texture. Perhaps something like this, adjusting S1 and S2 to taste:

#declare S1=1.1;
#declare S2=2;

...

 cylinder { <0, 0, 0>, <0, 1, 0>, 25
  scale <S1, 1, S2>
 }

...

 }
 scale<0.5/S1,1,1.5/S2>
 scale<1,100,1>
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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