POV-Ray : Newsgroups : povray.newusers : image map Server Time
12 Oct 2026 06:13:51 EDT (-0400)
  image map (Message 1 to 17 of 17)  
From: ulli
Subject: image map
Date: 12 Jun 2002 20:13:02
Message: <3D07E392.6060702@gmx.de>
hi,
iv got another problem with my beer bottle. the labels are should only 
be once on the bottle, but they are each twice (horizontal)
here´s the code:
texture {
       pigment {rgbf <0.3, 0.13, 0.075, 1.35>    }       }

      texture { pigment {
    image_map { png "beer2.png"
                        once
                        interpolate 2

          }}

             translate <-0.5+a,0.1+b,c>
             scale <4/10,6.2/10,4/10> }
      interior { ior 1.5 }
      texture {beero}
       translate < a, b , c >
       finish {
         ambient 0.5
         diffuse 0.35
         brilliance 0.5
         specular 0.1
         roughness 0.000009
         reflection { 0.48  fresnel}
         conserve_energy}


Post a reply to this message

From: bob h
Subject: Re: image map
Date: 13 Jun 2002 00:23:58
Message: <3d081e5e@news.povray.org>
"ulli" <ull### [at] gmxde> wrote in message news:3D0### [at] gmxde...
> iv got another problem with my beer bottle. the labels are should only
> be once on the bottle, but they are each twice (horizontal)

Yes, because the default (planar type) mapping is infinitely thick. You
would need to either use map_type 2 (cylindrical) instead or slice the
bottle in half vertically then apply the image map texture to one half and
leave other half without it (for example, but whatever way you want to go
about that). Obviously cylindrical mapping is easiest, you just need to
compensate for it in the image used to wrap it, leaving plenty of blank
space.  pi * height, for the dimensions.

bob h


Post a reply to this message

From: ulli
Subject: Re: image map
Date: 15 Jun 2002 07:25:37
Message: <3D0B2438.50104@gmx.de>
Obviously cylindrical mapping is easiest, you just need to
> compensate for it in the image used to wrap it, leaving plenty of blank
> space.  pi * height, for the dimensions.
> 
> bob h
> 
> 
> 

pi*height for dimensions???
could you explain this? *g*
i know what pi is, but which height for which dimension?
i´ve tried a little bit but it always looked a bit strange


Post a reply to this message

From: Simon Adameit
Subject: Re: image map
Date: 15 Jun 2002 07:32:56
Message: <3d0b25e8@news.povray.org>
bob h wrote:
> Obviously cylindrical mapping is easiest, you just need to
> compensate for it in the image used to wrap it, leaving plenty of blank
> space.  pi * height, for the dimensions.
>
Why should he compensate in the image and not scale it in POV?


Post a reply to this message

From: ulli
Subject: Re: image map
Date: 15 Jun 2002 08:05:05
Message: <3D0B2D7B.1010402@gmx.de>
Simon Adameit wrote:
> bob h wrote:
> 
   pi * height, for the dimensions.
>>
> 
> Why should he compensate in the image and not scale it in POV?
> 

would i have to try it out, or can i calculate it??


Post a reply to this message

From: ulli
Subject: Re: image map
Date: 15 Jun 2002 11:11:30
Message: <3D0B592D.4070107@gmx.de>
http://www.winter-privat.de/bottle.jpg
this is how it looks with cylindrical map type and wider label (the 
bottom label)
"jagdherren pils" is written on the label


Post a reply to this message

From: TinCanMan
Subject: Re: image map
Date: 15 Jun 2002 14:11:25
Message: <3d0b834d$1@news.povray.org>
"Simon Adameit" <gom### [at] gmxde> wrote in message
news:3d0b25e8@news.povray.org...
>
> bob h wrote:
> > Obviously cylindrical mapping is easiest, you just need to
> > compensate for it in the image used to wrap it, leaving plenty of blank
> > space.  pi * height, for the dimensions.
> >
> Why should he compensate in the image and not scale it in POV?

Cylidrical image_maps take the entire image and fits the height to 1 POV
unit in the y axis and wraps the texture once around the y axis.  You can
then scale it in the y direction but (without using a different method) the
image can't be scaled around the y-axis.  In order to get the label to wrap
partially around the bottle (unless you want it fully wrapped) you have to
compensate in the image_map image itself.

-tgq


Post a reply to this message

From: Warp
Subject: Re: image map
Date: 15 Jun 2002 16:24:24
Message: <3d0ba278@news.povray.org>
TinCanMan <Tin### [at] hotmailcom> wrote:
> In order to get the label to wrap
> partially around the bottle (unless you want it fully wrapped) you have to
> compensate in the image_map image itself.

  This is quite an ugly method because you either need to make an extra-large
image, which will consume unneeded memory, or you'll have to use a lower
resolution. Not nice.
  Instead of this, make a pigment with your image_map (using the 'once'
option), scale it down to the desired size and then apply the cylindrical
warp to it.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: ulli
Subject: Re: image map
Date: 15 Jun 2002 17:26:39
Message: <3D0BB11A.70100@gmx.de>
i really dont know what im doing wrong, but the labe always get 
strectched on the left/rigth edge (http://www.winter-privat.de/bottle2.jpg)
this one is with pigment map for the lower label


Post a reply to this message

From: bob h
Subject: Re: image map (cylindrical warping?)
Date: 15 Jun 2002 21:42:57
Message: <3d0bed21@news.povray.org>
"ulli" <ull### [at] gmxde> wrote in message news:3D0### [at] gmxde...
> i really dont know what im doing wrong, but the labe always get
> strectched on the left/rigth edge
(http://www.winter-privat.de/bottle2.jpg)
> this one is with pigment map for the lower label

Coming back late on this. I am not much on using 'warp', expecially the new
types, so all I could do is:


camera {
  location  <1,3,-5>
  right     x*image_width/image_height
  look_at   <0,2,0>
}

light_source {
  <-30, 30, -30>,
  color rgb 1
}

plane {
  y, -0.001
  texture {
    pigment { checker color rgb <1,1,0> color rgb <0,1,0> }
  }
}

cylinder {
  0, 2*y, 1
  texture {
    pigment {
      image_map {
        png "testlabel.png" // I used 300 by 300 res. for this
        interpolate 2
        once
        filter 255, 2/3 // set a pallete index to filtered value
      }
      warp {
        cylindrical
        orientation z
        dist_exp 0
        }
      rotate -90*y
      scale <1,2,1>
    }
  }
 scale <1,2,1>
}

This wraps around like map_type 2 in image_map but I couldn't get the effect
Warp mentioned. I scaled and changed dist_exp only to get a distorted label,
apparently similar to your outcome, ulli.
Either I misunderstood or I didn't hit upon the correct transformation.

bob h


Post a reply to this message

From: bob h
Subject: Re: image map
Date: 15 Jun 2002 22:27:24
Message: <3d0bf78c@news.povray.org>
You know the idea then, I'm sure.

Say a 3.14*100 wide image (in pixels) is the pi, or cylinder circumference,
and the height is always 1 POV unit to start with; but you'd then want that
number to be a 3.14:0.5 (yeah, 0.5, not 1.0) ratio of width to height.
Voila! 314 wide by 50 height, or any rescale of that ratio, will fit
proportionally correct on a POV unit cylinder primitive because it is 2
units diameter, 1 unit tall, and pi*2 units in circumference.

I sort of misspoke before by not pointing out map_type 2 has such a "unit"
system to it. It's not 1 in diameter. I really shouldn't have ever said it
the way I did so haphazardly, pi * height is just plain wrong. It's actually
pi * (height/2). Sorry, I can confuse better than I can help  ;-)
Were the units done differently it would be simpler to think of it as 1 for
diameter, 1 for height, making it pi for circumference. So try to keep that
in mind, that it is 2 across instead yet only 1 unit tall.

Okay, I'm probably digging myself into a hole so I'll shut up now.

bob h


Post a reply to this message

From: Simon Adameit
Subject: Re: image map (cylindrical warping?)
Date: 16 Jun 2002 00:26:05
Message: <3d0c135d@news.povray.org>
>
> This wraps around like map_type 2 in image_map but I couldn't get the
effect
> Warp mentioned. I scaled and changed dist_exp only to get a distorted
label,
> apparently similar to your outcome, ulli.
> Either I misunderstood or I didn't hit upon the correct transformation.
>
You need to scale before you apply the warp.


Post a reply to this message

From: ulli
Subject: Re: image map
Date: 16 Jun 2002 10:26:13
Message: <3D0CA011.20907@gmx.de>
bob h wrote:

> Voila! 314 wide by 50 height, or any rescale of that ratio, will fit
> 

ive tried it, but the label only doesnt get distorted if i use the 
initial translate and scale settings. but then its size isnt correct.
these are the settings:
             translate <-0.5,0.1,0>
           scale <4/10,6.2/10,4/10>


http://www.winter-privat.de/bottle3.jpg
and that is the bottle


Post a reply to this message

From: TinCanMan
Subject: Re: image map
Date: 16 Jun 2002 10:49:57
Message: <3d0ca595$1@news.povray.org>
> ive tried it, but the label only doesnt get distorted if i use the
> initial translate and scale settings. but then its size isnt correct.
> these are the settings:
>              translate <-0.5,0.1,0>
>            scale <4/10,6.2/10,4/10>

Hmmm, remember this mantra 'scale, then translate, scale, then translate'

First of all, cylindrical image_maps are defined around the 'y' axis and
extends from y=0 to y=1 so your object needs to be centered on the y axis
before applying the image_map if you don't want weird results.

Likewise, scaling (also rotation) occurs around the origin. You should
always create your object at the origin and apply any scaling before
translating.

-tgq


Post a reply to this message

From: bob h
Subject: Re: image map (cylindrical warping)
Date: 16 Jun 2002 12:07:20
Message: <3d0cb7b8@news.povray.org>
"Simon Adameit" <gom### [at] gmxde> wrote in message
news:3d0c135d@news.povray.org...
>
> You need to scale before you apply the warp.

Thanks Simon, that sure seems to be the answer all right.


camera {
  location  <1,2,-4>
  right     x*image_width/image_height
  look_at   <0,0,0>
  angle 50
}

light_source {
        <-30,30,-30>,
        1
}

plane {
  y, -0.001
  texture {
    pigment { checker color rgb <1,1,0> color rgb <0,1,0> }
  }
}

cylinder {
  0, y, 1
  texture {
    pigment {
      image_map {
        png "testlabel2.png" // a 314 wide by 50 high image
        interpolate 2
        once
        filter 215, 2/3
      }
        scale <.25,.25,1>
        translate y/2
      warp {
        cylindrical
        orientation z
        dist_exp 0
        }
      rotate 120*y
    }
  }
}

Something strange happens with the cylinder here. Looks like coincident
surfaces to me except it also reverses the checker pattern of the floor
plane, as seen through that otherwise invisible cylinder. Only the label has
texture, no 'ior' in that.

bob h


Post a reply to this message

From: Warp
Subject: Re: image map (cylindrical warping)
Date: 16 Jun 2002 15:52:00
Message: <3d0cec60@news.povray.org>
bob h <omn### [at] charternet> wrote:
> Something strange happens with the cylinder here. Looks like coincident
> surfaces to me except it also reverses the checker pattern of the floor
> plane, as seen through that otherwise invisible cylinder. Only the label has
> texture, no 'ior' in that.

  It doesn't seem to be related to the texture (if you apply any trasnparent
texture to the cylinder, the same artifact happens).
  I don't know why it happens, but if you make the plane y, -0.01 then
it fixes it.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: bob h
Subject: Re: this plane under cylinder oddity
Date: 16 Jun 2002 22:02:29
Message: <3d0d4335$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message
news:3d0cec60@news.povray.org...
> bob h <omn### [at] charternet> wrote:
> > Something strange happens with the cylinder here. Looks like coincident
> > surfaces to me except it also reverses the checker pattern of the floor
> > plane, as seen through that otherwise invisible cylinder. Only the label
has
> > texture, no 'ior' in that.
>
>   It doesn't seem to be related to the texture (if you apply any
trasnparent
> texture to the cylinder, the same artifact happens).
>   I don't know why it happens, but if you make the plane y, -0.01 then
> it fixes it.

Interesting. I checked that as you said and found now that if it's
at -0.00101 or -0.00099 there's no artifacting. Strange, huh...? I can't
figure any reasoning for this.

bob h


Post a reply to this message

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