POV-Ray : Newsgroups : povray.general : Rectangular Image map Server Time
2 Nov 2024 17:17:32 EDT (-0400)
  Rectangular Image map (Message 1 to 4 of 4)  
From: DranoMax
Subject: Rectangular Image map
Date: 18 Nov 2010 20:40:01
Message: <web.4ce5d4cd1c6c638db6bda1ce0@news.povray.org>
Hello everyone, I'm attempting to load a bmp file as an image map onto a box,
however, it keeps getting cut from it's original resolution into a square shape.
 Should I be trying to image map onto a different shape, or is there something I
need to declare?

Thanks


Post a reply to this message

From: Alain
Subject: Re: Rectangular Image map
Date: 18 Nov 2010 21:48:21
Message: <4ce5e575@news.povray.org>

> Hello everyone, I'm attempting to load a bmp file as an image map onto a box,
> however, it keeps getting cut from it's original resolution into a square shape.
>   Should I be trying to image map onto a different shape, or is there something I
> need to declare?
>
> Thanks
>
>
An image_map is always maped to a unit square.
You only need to scale it to the desired dimention:
texture{image_map{bmp "Your_bitmap.bmp"}scale Desired_Dimention}

You can also apply the image to this box:
box{0, 1 [Your image goes here] scale The_Dimention_you_Want}


Alain


Post a reply to this message

From: stbenge
Subject: Re: Rectangular Image map
Date: 19 Nov 2010 11:27:57
Message: <4ce6a58d$1@news.povray.org>
On 11/18/2010 5:37 PM, DranoMax wrote:
> Hello everyone, I'm attempting to load a bmp file as an image map onto a box,
> however, it keeps getting cut from it's original resolution into a square shape.
>   Should I be trying to image map onto a different shape, or is there something I
> need to declare?
>
> Thanks

Hi DranoMax,

With the new beta versions of POV-Ray you can use max_extent() to 
retrieve the original size of your image. Here's an example:

// declare the image
#declare image =
pigment{
  image_map{
   sys "some_image.bmp"
  }
}

// get the x/y dimensions of the image (returns a 2D vector)
#declare image_size = max_extent(image);

box{0, 1

  // map image to <0,0>-<1,1>
  pigment{image}

  // center the box
  translate -0.5

  // scale it proportionately so that the box's width equals one unit
  scale image_size/image_size.x
}

It's often easier to map your image to a unit box and just scale from there.

Sam


Post a reply to this message

From: DranoMax
Subject: Re: Rectangular Image map
Date: 19 Nov 2010 13:40:01
Message: <web.4ce6c45491f5452cb6bda1ce0@news.povray.org>
Great, thanks guys!  It works perfect now.


Post a reply to this message

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