POV-Ray : Newsgroups : povray.newusers : image_map on more than x-y plane? Server Time
1 Nov 2024 10:19:28 EDT (-0400)
  image_map on more than x-y plane? (Message 1 to 7 of 7)  
From: rob-p
Subject: image_map on more than x-y plane?
Date: 21 Jul 2009 17:40:01
Message: <web.4a663589319b024b5b19dea50@news.povray.org>
I want to create a rounded cube with one image mapped to all 6 sides. I tried
using image_map, but this only gives me two (opposite) sides (and one is
mirrored). I do understand how image_map works, so maybe it is just not the
right tool for what I want.

Any help would be appreciated.

-- rob-p


Post a reply to this message

From: Warp
Subject: Re: image_map on more than x-y plane?
Date: 21 Jul 2009 17:50:40
Message: <4a663830@news.povray.org>
rob-p <rob### [at] gmailcom> wrote:
> I want to create a rounded cube with one image mapped to all 6 sides. I tried
> using image_map, but this only gives me two (opposite) sides (and one is
> mirrored). I do understand how image_map works, so maybe it is just not the
> right tool for what I want.

> Any help would be appreciated.

  If you are using povray 3.7, you can use the cubic warp to wrap the image
around the cube. (The mapping will be done in the same way as box uv-mapping
does. See the documentation about uv-mapping, more precisely that of the box
primitive, to get an idea.)

-- 
                                                          - Warp


Post a reply to this message

From: rob-p
Subject: Re: image_map on more than x-y plane?
Date: 22 Jul 2009 16:55:00
Message: <web.4a677bef1645fb935b19dea50@news.povray.org>
Hi Warp, thanks for the suggestion. I'm currently using 3.6, but I checked the
documentation on uv_mapping and it looks like what I want. However, since I use
a superellipsoid for my rounded cube, it won't work in 3.6. Does the cubic warp
in 3.7 support superellipsoids?

In the mean time I found some kind of work-around by defining 3 cubes that are
slightly shifted with respect to each other (see code below). Although it's
just a work-around, I can proceed with my project.

Here is my work-around:

#macro my_cube(x_rot, y_rot, z_rot)
  superellipsoid {
    <0.3, 0.3>
    texture {
      pigment {
        image_map {
          gif "animal.gif"
          filter all 0.6
        }
        scale 2
        translate 1*x
        translate 1*y
        rotate x_rot*x
        rotate y_rot*y
        rotate z_rot*z
      }
      finish {
        phong 1.0
        phong_size 10
        ambient 0.2
        diffuse 0.8
      }
    }
  }
#end

union {
  object { my_cube( 0,  0,  0) }
  object { my_cube( 0, 90,  0) translate -0.01*x translate  0.01*z }
  object { my_cube(90,  0,  0) translate  0.01*y translate  0.01*z }
  rotate -45*x
  rotate -45*y
}


Post a reply to this message

From: Warp
Subject: Re: image_map on more than x-y plane?
Date: 22 Jul 2009 17:30:26
Message: <4a6784f2@news.povray.org>
rob-p <rob### [at] gmailcom> wrote:
> Hi Warp, thanks for the suggestion. I'm currently using 3.6, but I checked the
> documentation on uv_mapping and it looks like what I want. However, since I use
> a superellipsoid for my rounded cube, it won't work in 3.6. Does the cubic warp
> in 3.7 support superellipsoids?

  Warp transformations are applied to textures, and textures can be applied
to any objects.

  There is a way to achieve a similar effect in povray 3.6, but it's a bit
complicated.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: image_map on more than x-y plane?
Date: 22 Jul 2009 18:54:15
Message: <4a679897$1@news.povray.org>

> I want to create a rounded cube with one image mapped to all 6 sides. I tried
> using image_map, but this only gives me two (opposite) sides (and one is
> mirrored). I do understand how image_map works, so maybe it is just not the
> right tool for what I want.
> 
> Any help would be appreciated.
> 
> -- rob-p
> 
> 
> 

If you don't use the version 3.7 beta, for whatever reason:

If you want the same image to appears on all 6 sides, you can make a 
small box. You apply the image to that box, and place 6 copies to make 
each faces and use a frame of cylinders and spheres to make the rounded 
edges. The images will not meet but will be separated by the rounded edges.
The same can be done with 6 different images using one for each faces.

If you have one image that you want to wrap around your cube:
You'll need to model each faces separately, including part of the 
rounded edges.
Using scale and translate, you apply part of your image to each faces.
Finaly, you rotate and translate the parts to build the complete box.


Alain


Post a reply to this message

From: Leroy Whetstone
Subject: Re: image_map on more than x-y plane?
Date: 30 Jul 2009 12:59:38
Message: <4A71D121.4060909@joplin.com>
I knew I had something that could help. It just took some time to find 
it. You probly already found a solution.

  Here's what I got:

// warp cube pattern a 6 face pattern with bordor
// Vers: 3.6
// Auth: Leroy Whetstone Email llr### [at] joplincom
#include "colors.inc"

#declare Border=.2;//percent of border
#declare BorderPig=pigment{Gold}//border color

//--- cube with border pattern--------

#declare PyramidA = function { abs(x)+Border < y & abs(z)+Border < y};

#declare CubePattern =
   function
   { PyramidA(x, -z, y)*1/6+
     PyramidA(y, x, z)*2/6+
     PyramidA(x, z, y)*3/6+
     PyramidA(y, -x, z)*4/6+
     PyramidA(x, y, z)*5/6+
     PyramidA(x, -y, z)
   };


//-------- Images --------------

#declare Image1 =
   pigment
   { image_map { tga "Flowerb" }
     translate -.5
     scale 2
     //scale 1-Border
   }

#declare Image2 =
   pigment
   { image_map { tga "Mes" }
     translate -.5
     scale 2
   };

//-------- end of images -----------

#declare ThePigment =
   pigment
   { function { CubePattern(x, y, z) }
     pigment_map
     { #if(Border)[0/6 BorderPig] #end  //corners
       [0/6 Image2 scale 1-Border rotate x*90]  //top
       [1/6 Image1 scale 1-Border]              //front
       [2/6 Image1 scale 1-Border rotate -y*90] //left
       [3/6 Image1 scale 1-Border rotate y*180]//back
       [4/6 Image1 scale 1-Border rotate y*90]  //right
       [5/6 Image2 scale 1-Border rotate -x*90] //bottom @
     }
    turbulence .1
   };

//-----------  TESTs --------------

   camera{ location <0,0,-5>
         look_at <0,0,0>
         right x*image_width/image_height
         }
   background{White}
   light_source { <15, 20, -50>, 2 }

//box{-1,1  pigment { ThePigment }  rotate y*30 rotate x*-30}
//sphere{0,1  pigment { ThePigment }  rotate y*30 rotate x*-30}

superellipsoid
{ <.2, .2>
   pigment { ThePigment }
   rotate -x*clock*360
}

This will let you put up to six different images on a cube with or with 
out borders. Just add images to 'ThePigment' pigment


Post a reply to this message

From: rob-p
Subject: Re: image_map on more than x-y plane?
Date: 8 Aug 2009 10:30:00
Message: <web.4a7d8b4b1645fb935b19dea50@news.povray.org>
Thanks for your help everybody. I got it working.


Post a reply to this message

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