POV-Ray : Newsgroups : povray.unofficial.patches : Square and triangular pattern : Re: Square and triangular pattern Server Time
2 Sep 2024 18:14:33 EDT (-0400)
  Re: Square and triangular pattern  
From: Nieminen Juha
Date: 30 Aug 1999 11:18:50
Message: <37caa0da@news.povray.org>
J. Grimbert <jgr### [at] atos-groupcom> wrote:
: I finally made my first patch in POV:
:  I added two patterns similar to the HEXAGON/CHECKER
:  one that fills the x-y plane with squares, alterning four "colours"

  At least this one is easy to achieve without needing to patch povray.
Something like:

#macro SquarePattern(pigm1,pigm2,pigm3,pigm4)
  #local Row1=
    pigment
    { gradient x pigment_map
      { [0 pigm1]
        [.5 pigm1]
        [.5 pigm2]
        [1 pigm2]
      }
    }
  #local Row2=
    pigment
    { gradient x pigment_map
      { [0 pigm3]
        [.5 pigm3]
        [.5 pigm4]
        [1 pigm4]
      }
    }
  gradient y pigment_map
  { [0 Row1]
    [.5 Row1]
    [.5 Row2]
    [1 Row2]
  }
  scale 2
#end

#declare P1=pigment { rgb z }
#declare P2=pigment { marble turbulence .5 scale .3 }
#declare P3=pigment { granite scale .2 }
#declare P4=pigment { rgb y }
camera { location -z*5 look_at 0 }
plane
{ -z,0
  pigment { SquarePattern(P1,P2,P3,P4) translate -10 }
  finish { ambient 1 }
}


  My motto is: Why do something with an external program or patching
povray, if you can do it with povray itself without noticeable performance
loss?

: and another that fills the x-y plane with triangle, using six "colours".

  This one is not as trivial as the previous one, but I'm sure it's also
possible with pigment_maps.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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