POV-Ray : Newsgroups : povray.general : How to adjust image_map? : Re: How to adjust image_map? Server Time
20 Apr 2024 00:48:08 EDT (-0400)
  Re: How to adjust image_map?  
From: Bald Eagle
Date: 20 Feb 2020 15:50:01
Message: <web.5e4ef0d58411a31b4eec112d0@news.povray.org>
"Kima" <nomail@nomail> wrote:

> 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)?
>
> I can move the image by translate<0,0.5,0>, but it is not practical as I have to
> find the image height on the object.
>
> We need something like Center_Object, but image_map is not an object.

And image map is always like a square in the x-y plane, infinite in the
z-direction, unless rotated.




> 2. map_type 2 makes a full wrap cylindrically. How can I make image_map half
> wrap or to a custom degree (instead of 360)?

IIRC, you omit the "once" keyword, and then you can scale your image by 0.5 with
respect to the object's circumference.

> By scale, we can control the image over the y-axis, but the scale on the x-axis
> has no effect.

When I do my image maps, I do the following:
        #declare XSize = 1.965;
 #declare ImageMap =
          pigment {image_map {png ImageFilename once} };
 #declare Resolution = max_extent (ImageMap);
 #declare Resolution = Resolution + <0, 0, 1>;
This gives me a vector with <Xpixels, Ypixels, 1>

Then I make an actual box:
Notice the formula for scaling, which keeps the aspect ratio of the original
image.

 #declare ImageMappedBox =
  box {0, 1
   texture {
    pigment {ImageMap}
    finish {diffuse 1}
   }
   translate <-0.5, -0.5, 0>
   scale Resolution*(1/Resolution.x)*XSize
   //translate y*(Resolution.y / Resolution.x)*XSize/2
  }

object {ImageMappedBox rotate x*90 translate Offset scale ImageScale}

You might make a demo file for yourself that does everything you want, and keep
a copy in your Insert Menu directory.


Post a reply to this message

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