POV-Ray : Newsgroups : povray.binaries.images : Baseball, 24kbu : Re: Baseball, 24kbu Server Time
3 Oct 2024 04:55:29 EDT (-0400)
  Re: Baseball, 24kbu  
From: Eric Freeman
Date: 21 Feb 2000 03:46:28
Message: <38b0fb64@news.povray.org>
"Sigmund Kyrre Aas" <as### [at] studntnuno> wrote in message
news:38B02C3E.D0BC1000@stud.ntnu.no...
>
> Nice tutorial, but it didn't solve my problem.
>
> Now I've tried material maps too, but I get the
> same message when I try to use them in layers:
> "Cannot layer a patterned texture over another"
>
> sig.

Here's a code snippet from a drinking glass I made using a different
technique.  Basically you create a second object (slightly larger than the
original and hollow), apply the logo image map to it, and chop off the back
half by differencing it with a box.

// make a drinking glass from the difference
// of two cylinders
#declare GlassMain = difference {
  cylinder {
    <0,0,0>,
    <0,Hite,0>
    Rad
  }
  cylinder {
    <0,0.1,0>,
    <0,Hite+1,0>
    Rad*0.9
  }
  material {GlassMat}
}

// make another hollow cylinder with a slightly larger
// radius than the drinking glass and chop off the back
// of it by differencing it with a box
#declare Logo = difference {
  cylinder { // main cylinder
    <0, -0.7, 0>,
    <0,  0.7, 0>
    Rad+0.00002
  }
  cylinder { // cut-out
    <0,-0.71,0>,
    <0,0.71,0>
    Rad+0.00001
  }
  box { // chop off the back half of the cylinder
    <-Rad-0.1,-0.71,0>,
    <Rad+0.1,0.71,Rad+0.1>
  }
  texture {
    pigment {
      image_map {
        gif "logo_image.gif"
        transmit 209, 1.0 // make the background of the image transparent
        once
        map_type 0
        interpolate 2
      }
    }
    // scale the logo to fit
    translate <-0.5,-0.5,0>
    scale <224/167,1,1>
    scale 1.4
  }
  // position the logo cylinder on the drinking glass
  translate <0,3.75,0>
  rotate y*11
}

#declare DrinkingGlass = union {
  object {GlassMain}
  object {Logo}
}

Eric
--------------------
http://www.datasync.com/~ericfree
--------------------
"The whole problem with the world is that fools and fanatics are always so
certain of themselves, but wiser people so full of doubts."
--Bertrand Russel


Post a reply to this message

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