POV-Ray : Newsgroups : povray.programming : Request: new pigment : Re: Request: new pigment Server Time
28 Jul 2024 22:23:54 EDT (-0400)
  Re: Request: new pigment  
From: Ronald L  Parker
Date: 6 Apr 1999 23:44:28
Message: <370cc376.28317605@news.povray.org>
/*
On Tue, 06 Apr 1999 19:29:49 -0400, Anthony Bennett
<ben### [at] panamaphoenixnet> wrote:

>Wouldn't it just be easier and faster to have a predetermined pigment like
>that? If not, then bring on the macro!

No sooner said than done (I had already been working on it.)  Just
paste this whole article into POV and render.  Scale is a little
funky--the hexes are one unit from point to point.  That makes the
calculation of mortar thickness a little tricky but not impossible.
Just divide the thickness you want by .866 and subtract from 1 to
get the cutoff to use in the color_map.

Indentation is ignored for the sake of compactness.  Either that or
Tyler Syndrome is contagious.
*/

#macro HexTiles( Map )                                           
  #local hexGrad=pigment { gradient x 
  color_map {Map} scale sqrt(3)/2+.0001}
  #local hexBlock=pigment { radial pigment_map{
  #local i=0; #while (i<6)
  [i/6 hexGrad rotate (30+60*i)*y] 
  [(i+1)/6 hexGrad rotate (30+60*i)*y]
  #local i=i+1; #end}}
  radial pigment_map {
    [0/3 hexBlock translate <.5,0,-sqrt(3)/2>]
    [1/3 hexBlock translate <.5,0,-sqrt(3)/2>]
    [1/3 hexBlock translate <-1,0,0>]
    [2/3 hexBlock translate <-1,0,0>]
    [2/3 hexBlock translate <.5,0,sqrt(3)/2>]
    [3/3 hexBlock translate <.5,0,sqrt(3)/2>]
  }
  translate x 
  warp {repeat 1.5*x flip x} 
  warp {repeat .5*sqrt(3)*z flip z}
  scale .5
#end

plane { y,0
  pigment {HexTiles(color_map{[.95 red .7] [.95 rgb 1]})}
}

camera { location 12*y sky z look_at 0 }
light_source { 6*y rgb 1}


Post a reply to this message

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