POV-Ray : Newsgroups : povray.general : Imagemap MapType : Re: Imagemap MapType Server Time
10 Aug 2024 17:30:28 EDT (-0400)
  Re: Imagemap MapType  
From: Chris Colefax
Date: 17 Nov 1999 22:02:58
Message: <38336c62@news.povray.org>
Ron Parker wrote:
> Chris Colefax posted a gargantuan texture to do this to CGRR sometime
> in the past year.  Someone has it archived on a website somewhere, or
> I might have copied it to this server somewhere.  I wish I remembered
> better.  Peter?

Ken <tyl### [at] pacbellnet> wrote
> I just sent him an email asking him if he still has the source for
that.
>
> Wait............

But not for too long (despite appearances I generally check all the
relevant news servers on a daily basis).  A direct quote from the
message posted to c.g.g.r:

Solution 1, as previously recommended:

   #declare Face = plane {-z, .5
      pigment {image_map {tga "Image"} translate -.5}}

   #declare Box = intersection {
      object {Face} object {Face rotate y * 90}
      object {Face rotate y * 180} object {Face rotate y * 270}
      object {Face rotate x * 90} object {Face rotate x * -90}}

The box is created from <-.5, -.5, -.5> to <.5, .5, .5>, which you can
transform as you like.  You can also use the Box object in CSG
operations, but the texture itself is not actually solid, which brings
us to solution 2:

#macro cube_map (base_pigment)
   #local I = pigment {base_pigment translate <-.5, -.5, -.5>}

   #local I2 = pigment {radial pigment_map {
      [.125 I rotate <90, 0, -90>]
      [.125 I rotate <0, 0, -90>] [.375 I rotate <0, 0, -90>]
      [.375 I rotate <-90, 0, -90>] [.625 I rotate <-90, 0, -90>]
      [.625 I rotate <0, 180, -90>] [.875 I rotate <0, 180, -90>]
      [.875 I rotate <90, 0, -90>]}
      rotate z * 90}

   #local I3 = pigment {radial pigment_map {
      [.125 I rotate <-90, 0, 90>] [.125 I] [.375 I]
      [.375 I rotate <-90, 0, 270>] [.625 I rotate <-90, 0, 270>]
      [.625 I rotate <180, 0, 0>] [.875 I rotate <180, 0, 0>]
      [.875 I rotate <-90, 0, 90>]}
      rotate x * 90}

   radial pigment_map {
      [.125 I3] [.125 I2] [.375 I2] [.375 I3]
      [.625 I3] [.625 I2] [.875 I2] [.875 I3]}
#end

Save this macro to a file, and then include that file into your scene.
Now you can create a genuinely solid texture with the image arranged in
a cube, eg:

   box {-.5, .5
      pigment {cube_map (pigment {image_map {tga "Image"}} ) }
      scale <1, 2, 3> rotate <15, -35, 0> translate <-5, 10, 3>}

The advantage of this method is that you're not restricted to boxes -
you can apply the pigment to any object (including CSG differences and
intersections), and you can actually use *any* pigment in place of the
image_map.  The pigment is basically like six pyramids with their apexes
(or apices, if you prefer) stuck together to form the cube.

The image covers the base of each pyramid, but note that the joins
between the diagonal sides of each pyramid will be visible if you apply
the pigment to a non-cube surface - so we turn to Carl Perkins'
suggestion, ie. to use a warped image with spherical mapping.  Start by
creating a scene containing only a cube created using either of the
above methods, and given a finish {ambient 1} (eg. add the finish to the
Face plane above, and create a scene with object {Box}).  Now, add this
camera to the scene:

   camera {panoramic angle 180 right x up y rotate y * clock * 180}

and render a two frame animation at a square resolution (eg.
Final_Frame=2 Width=300 Height=300).  Join the resulting two frames
together, side by side (using DTA, or another image manipulation
program), and you will have a suitable, spherically-warped image, eg:

   box {-1, 1
      pigment {image_map {tga "Joined" map_type 1 interpolate 2}}
      rotate <45, -45, 0>}


Post a reply to this message

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