POV-Ray : Newsgroups : povray.general : image map on cone - help me understand : Re: image map on cone - help me understand Server Time
1 Aug 2024 12:21:39 EDT (-0400)
  Re: image map on cone - help me understand  
From: Chris B
Date: 11 Oct 2005 19:20:17
Message: <434c48b1$1@news.povray.org>
"Rick DeNatale" <ric### [at] denhaven2com> wrote in message 
news:434c2cef@news.povray.org...
> I'm modeling a Mercury spacecraft, and I'm trying to use an image map
> for some markings like the words UNITED/STATES and the American flag.
>
> The main cabin of the spacecraft which I'm trying to texture with an
> image_map is a truncated cone with an included angle of 40 degrees (or
> another way of saying this is that the sides are 20 degrees from the
> vertical.  Because of the drawings I'm using the cone is centered on the
> Z axis.
>
> The particular markings I'm starting with a the words UNITED and STATES
> vertically stacked with a small flag underneath.  The tops and bottoms
> of each word and the flag run along the circles defined by the
> intersection of the cone and planes parallel to the X-Y plane.  The
> sides lie on lines which run from the apex of the cone (if it were not
> truncated), to the base of the cone.
>
> So right now I've got something like this:
>
> #declare ConeTopRadius = 16;
> #declare ConeBotRadius = 37.25;
> #declare ConeTopZ = 161.71;
> #declare ConeBotZ = 103.18;
>
> #declare CabinCone = {
>    Cone {
>       <0,0,ConeBotZ>, ConeTopRadius,
>       <0,0,ConeTopZ>, ConeBotRadius
>    }
> }
>
> #declare Cabin = object {
>   object { CabinCone }
>   texture { ReneMetal }
>   texture {
>     pigment {
>       image_map {
>         png "maps/testmap.png"
>         map_type_2 // cylindrical map
>         once
>         scale <1, ConeTopZ-ConeBotZ,1>
>         rotate x*90  // put it concentric with the cone
>         translate z*ConeBotZ
>       }
>     }
>   }
> }
>
> The png is transparent with just the words and the flag with the words
> laid out normally.  I didn't go to great pains to make the aspect ratio
> of the image "correct" whatever that is, it's roughly the height of the
> truncated cone to the large circumference.
>
> The effect I'm getting is just the opposite of what I want, the tops of
> the words and flag are wider than the bottom rather than narrower which
> is what I want.  I don't understand how the image is being projected
> onto the cone well enough to understand what I'm seeing.  I got the
> scaling above by playing,
>
> I'm guessing that I'm going to somehow distort the original png image by
> keystoning parts, or is there a better way to accomplish what I want?

If the image only needs to wrap around the cone for a short way then you 
could align the cylindrical mapping with the edge of the cone rather than 
its central axis. Assuming the flag and text are roughly in the centre of 
the image you would need to rotate -90 degrees around y then 70 degrees 
around x  to place the text on the top surface of your cone. This places the 
writing approximately parallel with the conical surface for a short stretch. 
This will obviously distort too much if you need to wrap the image around 
more than about 30 percent of the circumference of the cone.

To get text wrapping right the way round the cone you could look at using a 
text object as a pigment. You could create a texture for each letter and 
orient each letter so that it's parallel to the surface of the cone at the 
position you want. Here's an example:


light_source { < 0, 1000  ,-30> color rgb 1 }
camera {location <0,100,50> look_at <0,0,150>}

#declare ConeTopRadius = 37.25;
#declare ConeBotRadius = 16;
#declare ConeTopZ = 161.71;
#declare ConeBotZ = 103.18;
#declare Apex = (ConeTopZ-ConeBotZ)*ConeBotRadius/
  (ConeTopRadius-ConeBotRadius);

#declare CabinCone = cone {
  <0,0,ConeBotZ>, ConeBotRadius,
  <0,0,ConeTopZ>, ConeTopRadius
}



#declare Cabin = object {
  CabinCone
  texture { pigment {color rgb <1,1,1>} }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "E" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+40)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate z*20
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "S" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+40)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate z*0
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "A" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+40)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate -z*20
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "/" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+30)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate z*0
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "R" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+20)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate z*20
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "S" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+20)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate z*0
    }
  }
  texture {
    pigment {
      object {
        text {ttf "arial.ttf" "A" 1, 0}
        color rgbt 1
        color <1,0,0>
      }
      translate <-0.3,0,-0.1>
      scale 10
      translate y*(Apex+20)
      rotate x*70
      translate z*(ConeBotZ-Apex)
      rotate -z*20
    }
  }
}

object {Cabin}


Post a reply to this message

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