POV-Ray : Newsgroups : povray.general : Hexagon pattern with 4 or 7 colors? : Re: Hexagon pattern with 4 or 7 colors? Server Time
28 Apr 2024 03:32:31 EDT (-0400)
  Re: Hexagon pattern with 4 or 7 colors?  
From: Bald Eagle
Date: 3 May 2018 20:35:00
Message: <web.5aeba9a597bd16015cafe28e0@news.povray.org>
I took a stab at it, but somehow with my numbered textures, it goes horribly
awry.

Having worked the initial pattern out, you likely stand a better chance of
seeing where it's going wrong and why.

I'll leave this here for you to fiddle with.

#version 3.7;
global_settings {assumed_gamma 1.0}

#include "colors.inc"

sky_sphere {pigment {rgb <1, 1, 1>}}

camera {
   location <0, 20, 0>    // position & direction of view
  look_at  <0, 0, 0.01>
  right x*image_width/image_height           // horizontal size of view
  up y // vertical size of view
 }

light_source {<0, 25, -1> color White}

#declare Num = array [10];
#for (N, 0, 9)
 #declare Num[N] = text {ttf "arialbd.ttf" chr(48+N) 100, 0 translate <0, 0,
-50>}
#end


#declare T = array [10];
#for (N, 0, 9)
 #declare Current = CHSV2RGB(<N*36, 1, 1>);
 #declare T[N] =
  pigment {
   pigment_pattern {
    object {Num[N]} // 1, 0}
    warp {repeat x}
    warp {repeat y}
   }
   pigment_map {
    [0.0 rgbft Current]
    //[0.9 rgbft Current]
    [1.0 rgb 0]
   }
  scale 0.25
  rotate x*90
  }

#end

/*
// This seems to work fine
box {<-1, 0.1, -1>*10, <1, 0.02, 1>*10
 texture { // #1
                  cells
                  texture_map {
     #for (N, 0, 0.9, 0.1)
      [N     T[N*10] ]
      [N+0.1 T[N*10] ]
      //#debug concat ( " N = ", str (N, 3, 1),  " N+0.1 = ", str (N+0.1, 3, 1),
 " N*10 = ", str (N*10, 3, 1), "\n")
     #end
    }
 }
  scale <3,1,3*.8660254>

}
*/

#declare SIN60 = sin (radians(60));

box {<-1, 0, -1>*10, <1, 0.01, 1>*10
 texture {
  //pigment{
  hexagon
  texture { // #1
   cells
   texture_map {
    #for (N, 0, 0.9, 0.1)
     [N     T[N*10] ]
     [N+0.1 T[N*10] ]
     //#debug concat ( " N = ", str (N, 3, 1),  " N+0.1 = ", str (N+0.1, 3, 1),
" N*10 = ", str (N*10, 3, 1), "\n")
    #end
   }
   scale <3, 1, 3*SIN60>
   // warp {repeat 3*.8660254*z offset <1.5,357.4,0>}
   // the x-offset has to be 1.5, or can increase by
   // adding multiples of 3.0 -- 1.5, 4.5, 7.5 etc.

   translate <0, 0, (1.5*SIN60)>
  } // end texture #1

  texture { // #2
   cells
   texture_map {
    #for (N, 0, 0.9, 0.1)
     [N     T[N*10] ]
     [N+0.1 T[N*10] ]
     //#debug concat ( " N = ", str (N, 3, 1),  " N+0.1 = ", str (N+0.1, 3, 1),
" N*10 = ", str (N*10, 3, 1), "\n")
    #end
   }
   scale <3, 1, (3*SIN60)>
   // warp {repeat 3*.8660254*z offset <1.5,194.7,0>} // ditto
   translate <1.5, 0, 0>
  } // end texture #2

  texture { // #3
   cells
   texture_map {
    #for (N, 0, 0.9, 0.1)
     [N     T[N*10] ]
     [N+0.1 T[N*10] ]
     //#debug concat ( " N = ", str (N, 3, 1),  " N+0.1 = ", str (N+0.1, 3, 1),
" N*10 = ", str (N*10, 3, 1), "\n")
    #end
   }
   scale <3, 1, (3*SIN60)>
   // warp {repeat 3*.8660254*z offset <1.5,73.3,0>} //ditto
   translate <0, 0, 0>
  } // end texture #3

  //}
  //finish {ambient .05 diffuse .95}
  //scale .2
 } // end hexagon texture
} // end box


Post a reply to this message

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