POV-Ray : Newsgroups : povray.general : Slope map problem : Slope map problem Server Time
31 Jul 2024 16:25:25 EDT (-0400)
  Slope map problem  
From: Vaclav Cermak
Date: 11 Dec 2006 09:18:49
Message: <457d68c9$1@news.povray.org>
Hi,

   I'am trying to create "box mapped" texture using slope_map, it looks like


...
	
   #declare _ArMa_pBM_compTable = array [7]
   #declare _ArMa_pBM_compTable[1] = array [6] { 0, 0, 0, 0, 0, 0 }
   #declare _ArMa_pBM_compTable[2] = array [6] { 0, 0, 0, 0, 1, 1 }
   #declare _ArMa_pBM_compTable[3] = array [6] { 0, 1, 0, 1, 2, 2 }
   #declare _ArMa_pBM_compTable[6] = array [6] { 0, 1, 2, 3, 4, 5 }

   #macro _ArMa_pBM_comp(From, Num)
     From[ _ArMa_pBM_compTable[ dimension_size(From, 1) ][ Num ] ]
   #end

   #macro ArMa_pBoxMap(Size, Pigments)
     #local _tmpPig0 = pigment {
       slope x
       pigment_map {
         [0.5 _ArMa_pBM_comp(Pigments, 3) rotate <0, 90, 0> translate 
<0, 0, Size.z>]
         [0.5 _ArMa_pBM_comp(Pigments, 1) rotate <0, -90, 0>]
       }
     }
     #local _tmpPig1 = pigment {
       slope z
       pigment_map {
         [0.25 _ArMa_pBM_comp(Pigments, 0)]
         [0.25 _tmpPig0]
         [0.75 _tmpPig0]
         [0.75 _ArMa_pBM_comp(Pigments, 2) rotate <0, 180, 0> translate 
<Size.x, 0, 0>]
       }
     }
     pigment {
       slope y
       pigment_map {
         [0.25 _ArMa_pBM_comp(Pigments, 4) rotate <-90, 0, 0> translate 
<0, 0, Size.z>]
         [0.25 _tmpPig1]
         [0.75 _tmpPig1]
         [0.75 _ArMa_pBM_comp(Pigments, 5) rotate <90, 0, 0>]
       }
     }
   #end

...

#declare Obj = box {
   <0, 0, 0>, <1, 1, 1>
   texture {
     ArMa_pBoxMap(<1, 1, 1>, array [6] {
       pigment {color rgb <1, 0, 0>}
       pigment {color rgb <0, 1, 0>}
       pigment {color rgb <0, 0, 1>}
       pigment {color rgb <1, 1, 0>}
       pigment {color rgb <1, 0, 1>}
       pigment {color rgb <0, 1, 1>}
     })
   }
   translate <-0.5, -0.5, -0.5>
}

union {
   object {Obj translate <-1.5, 0, 0>}
   object {Obj rotate <0, 45, 0>}
   object {Obj rotate <0, 90, 0> translate <1.5, 0, 0>}
   translate <0, 0.5, 0>
}

...


It partially works ... correctly for the first, unrotated cube. Second 
and third cubes looks like they are textured after transformation. It 
seems, that slope_map pattern is not affected by texture or object 
transformation...

   Does anybody know, how to fix this?

Regards

Vaclav


Post a reply to this message

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