POV-Ray : Newsgroups : povray.binaries.images : Coffee's On! - My Next CGSphere : Re: Coffee's On! - My Next CGSphere Server Time
2 Aug 2024 22:13:56 EDT (-0400)
  Re: Coffee's On! - My Next CGSphere  
From: Trevor G Quayle
Date: 14 Jun 2007 12:20:02
Message: <web.467169a8fabeec67c150d4c10@news.povray.org>
Here is some example source.  This is the mug and it's material (using the
attached image map).  In this example, the image is given a cylindrical
warp, but any kind of transform that is appropriate can be accomodated with
the right functions.
To make the image map, I just created an appropriate sized image file and
used the povlogo.ttf font style for the logo.  I then gave it a blur to
blur the edges so that it makes a rouded bump rather than an abrupt one.

Let me know if you have any questions about this.
//START
#declare MUGLOGO=function{pigment{image_map{png "MUG.png" once interpolate
2} warp{cylindrical} scale 99}}//wrap mug logo cylindrically and scale to
height of mug
#declare
MUGLOGO2=function{select(sqrt(x*x+z*z)-39,1,MUGLOGO(x,y,z).gray)}//Turn
into function (select function makes sure it only appears on outside of mug
object
#declare MMUG=
material{
  texture{
    pigment{function{MUGLOGO2(x,y,z)} colour_map{[0.99 rgb 0][0.99 rgb
<0.7,0.7,0.6>]}  //Apply pigment according to desired logo and background
colours
    }
    finish{
      conserve_energy
      diffuse 0.6
      ambient 0
      reflection{0 1 fresnel on metallic 0}
    }
    normal{
      average
      normal_map{
        [1 function{MUGLOGO2(x,y,z)} normal_map{[0.9 bumps 0.05 scale
0.25][1 bumps .015 scale 8]}]//apply different bumpiness to the logo and
the background
        [1 function{MUGLOGO2(x,y,z)} bump_size -0.5 poly_wave 10]
                      //normal gives the raised appearance to the logo
      }
    }
  }
  interior{
    ior 1.51
    caustics 1
    fade_distance 10
    fade_power 1000
  }
}

#declare CMug=
union{
  union{
    difference{
      cylinder{y,y*95,40}
      cylinder{y*8 y*100 36}
      cylinder{y*6 y*100 34}
      torus{34 2 translate y*8}
      cylinder{0 y*2 34}
      torus{34 2 scale <1,1/2,1> translate y*1}
    }
    torus{38 2 scale <1,2,1> translate y*95}
    torus{38 2 scale <1,1/2,1> translate y*1}
    union{//Handle
      difference{
        torus{34 4}
        intersection{
          plane{-x 0 rotate y*30}
          plane{-x 0 rotate -y*30}
        }
      }
      sphere{x*34 4 rotate y*60}
      sphere{x*34 4 rotate -y*60}
      scale<20/34,2,1>
      rotate x*90
      translate <-51,50,0>
    }
  }
    material{MMUG}
}

//END

-tgq


Post a reply to this message


Attachments:
Download 'mug.png' (54 KB)

Preview of image 'mug.png'
mug.png


 

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