POV-Ray : Newsgroups : povray.newusers : image_map on more than x-y plane? : Re: image_map on more than x-y plane? Server Time
6 Oct 2024 02:08:20 EDT (-0400)
  Re: image_map on more than x-y plane?  
From: Leroy Whetstone
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

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