POV-Ray : Newsgroups : povray.general : How to adjust image_map? : Re: How to adjust image_map? Server Time
20 Apr 2024 11:14:51 EDT (-0400)
  Re: How to adjust image_map?  
From: Alain Martel
Date: 20 Feb 2020 16:14:38
Message: <5e4ef6be$1@news.povray.org>
Le 2020-02-20 à 15:41, Kima a écrit :
> "jr" <cre### [at] gmailcom> wrote:
>> hi,
>>
>> "Kima" <nomail@nomail> wrote:
>>> I wrap an image over a lathe by
>>>
>>> lathe{
>>>    cubic_spline 8,
>>>       < 0.00, 0.00>,
>>>       < 0.60, 0.00>,
>>>       < 0.72, 0.44>,
>>>       < 0.31, 0.93>,
>>>       < 0.49, 1.26>,
>>>       < 0.48, 1.35>,
>>>       < 0.43, 1.56>,
>>>       < 0.16, 1.60>
>>>       texture{
>>>           pigment{
>>>               color rgb<1,0,0>
>>>           }
>>>       }
>>>       texture{
>>>           pigment{
>>>               image_map{
>>>                   png "image.png" map_type 2 interpolate 4 once
>>>
>>>               }
>>>
>>>           }
>>>       }
>>> }
>>>
>>> I have two problems:
>>>
>>> 1. image_map put the image on the object from the bottom (from south to north).
>>> Thus, if the image height is not enough to cover the object, it is always the
>>> top part, which is missing.
>>>
>>> How can I put the image from top to bottom or even on the middle (with respect
>>> to the y-axis)?
>>
>> using your code as posted, I inserted:
>> pigment {
>>    image_map {...}
>>    rotate <270,0,0>
>> }
>>
>> and the image covers the shape.  no ideas wrt second question.
>>
>>
>> regards, jr.
> 
> rotating the image_map deforms the image appearance. I do not want to change the
> image direction. I just want to move it up. 'translate <0,y,0>' does the job,
> but the problem is that I do not have a practical method to calculate `y` to
> move the image to the top.
> 
> 

You know the vertical size of your object.
It's bottom is set at Y=0.

So, you only need to scale by the vertical size of the object : 1.56.

Add :
scale<1, 1.56, 1>
to the pigment.

If you don't know that dimension, you can use
#declare YSize = (min_extent(Object_ID)-max_extent(Object_ID)).y;
Then, use :
scale<1, YSize, 1>

If you want to also flip the image vertically, then, do this :

scale <1, -YSize, 1>// Adjust height and flip.

If you don't use «once», there is no need to translate the image as one 
of the instances will fall at the correct place.


Post a reply to this message

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