POV-Ray : Newsgroups : povray.general : Hexagon pattern with 4 or 7 colors? : Re: Hexagon pattern with 4 or 7 colors? Server Time
13 May 2024 13:53:51 EDT (-0400)
  Re: Hexagon pattern with 4 or 7 colors?  
From: Kenneth
Date: 2 May 2018 05:05:01
Message: <web.5ae97ed097bd1601a47873e10@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

>
> You've inspired me; I'm experimenting with that idea...

Success! Random-colored hexagons. I didn't have to use the 'brick' pattern, just
cells.

-- For a horizontal surface, which is the default orientation of the hexagon
pattern.--

The three color-triad pigment blocks in the code are *almost* identical, but the
success lies in their translations, and in the offsets in warp{repeat...}. The
y-offsets are interesting-- they're actually arbitrary values, just to choose
some new 'color cubes' of the cells pattern. The cell colors are random from
cube to cube anyway, but the offsets kind of guarantee that the warp{repeats..}
are far separated from each other. Perhaps they're not really necessary; but
reduce the y-values to zero to see.

By default, each straight edge of POV-Ray's hexagon shape is 1-unit in length.
So the distance between opposite POINTS or vertices is 2.0 units, and the
distance between opposite EDGES is 2*sin(60), or 2*.8660254 units. The cells
patterns are scaled and translated so that they fully overlap each full hexagon
(but the overlaps aren't seen.)

The links that Bald Eagle provided were quite helpful with the hexagon math
details. (Thanks!)

Instead of fully random colors, the pigment_maps could have 4 or 7 or however
many 'segregated' colors, which was the original idea.

--------
texture{
      pigment{
           hexagon
           pigment{ // #1
                 cells
                 color_map{
                         [0 rgb <1,0,0>]
                         [.5 rgb <.3,1,0>]
                         [1.0 rgb <0,0,1>]
                         }
                 scale <3,1,3*.8660254>
                 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*.8660254>
                  }

           pigment{ // #2
                 cells
                 color_map{
                         [0 rgb .5*<1,0,0>]
                         [.5 rgb .5*<.3,1,0>]
                         [1.0 rgb .5*<0,0,1>]
                         }
                 scale <3,1,3*.8660254>
                 warp{repeat 3*.8660254*z offset <1.5,194.7,0>} // ditto
                 translate <1.5,0,0>
                  }

           pigment{ // #3
                 cells
                 color_map{
                         [0 rgb .25*<1,0,0>]
                         [.5 rgb .25*<.3,1,0>]
                         [1.0 rgb .25*<0,0,1>]
                         }
                 scale <3,1,3*.8660254>
                 warp{repeat 3*.8660254*z offset <1.5,73.3,0>} //ditto
                 translate <0,0,0>
                  }
             }

      finish{ambient .05 diffuse .95}
      scale .2
      }
      }


Post a reply to this message

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