POV-Ray : Newsgroups : povray.newusers : Can't get this mapped properly. : Re: Can't get this mapped properly. Server Time
5 Nov 2024 03:19:16 EST (-0500)
  Re: Can't get this mapped properly.  
From: TinCanMan
Date: 21 Jul 2002 23:28:37
Message: <3d3b7be5@news.povray.org>
You would probably be better to use an image_pattern texture than just an
image_map.  Image map only applies to pigment, whereas image_pattern lets
you apply different textures for each part of the image, for example if you
wanted the man to have a bumpy normal and the rest to be smooth.
See 6.7.11.20  for information on how it works

Here is a sample for you.  The first thing you need to do though is to
negative the image so the white part is black and the black part is white.
This is because image_pattern uses the greyscale value, anything outside the
image has a greyscale value of 0, so you want the area surrounding the man
to be the same so you don't have a square where the image is.

//start
#declare button =
union{
  cylinder{<0,0,0> <0,.5,0>,1.1 }
  difference{
    sphere{<0,0,0>,1.2 }
    box{<-5,.2,-5> <5,5,5>}
    box{<-5,-5,-5> <5,0,5>}
    translate .5*y
  }
  difference{
    cylinder{<0,.5,0> <0,1,0>,.9}
    sphere{<0,2,0>,1.2 scale<1.1,1,1.1> }
  }
  difference{
    torus{.8,.1 }
    box{<-5,0,-5> <5,-5,5>}
    translate 1*y
  }
  texture{
    image_pattern{gif "help-1.gif" once}//once to avoid repeating texture
    texture_map{
      [0 texture1] //texture where image is black and outside image
      [1 texture2] //texture where image is white
    }
    rotate x*90
    translate <-1/2,0,-1/2>
    scale <1,1,1.3> //image originally mapped an x-y plane from <0,0> to
<1,1>, rotate translate and scale to suit
  }
}
//end

-tgq


Post a reply to this message

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