POV-Ray : Newsgroups : povray.general : Thought for future pattern type - array : Re: Thought for future pattern type - array Server Time
29 Jul 2024 14:23:56 EDT (-0400)
  Re: Thought for future pattern type - array  
From: stbenge
Date: 18 Mar 2011 14:14:28
Message: <4d83a104@news.povray.org>
On 3/18/2011 10:51 AM, stbenge wrote:
> This can be accomplished with nested gradient x/y/z patterns and
> color_map #while loops.

Here's the basic idea:

#declare N_UnitsX = 32;
#declare N_UnitsY = 32;
#declare N_UnitsZ = 32;
#declare RSEED    = seed(1001);

box{0, 1
  pigment{
   gradient z
   pigment_map{

    #local Z=0;
    #while(Z<N_UnitsZ)
     [Z/N_UnitsZ
      gradient y
      pigment_map{
       #local Y=0;
       #while(Y<N_UnitsY)
        [Y/N_UnitsY
         gradient x
         pigment_map{
          #local X=0;
          #while(X<N_UnitsX)
           [X/N_UnitsX

            rgb <rand(RSEED),rand(RSEED),rand(RSEED)>

           ]
           #local X=X+1;
          #end
         }
        ]
        #local Y=Y+1;
       #end
      }
     ]
     #local Z=Z+1;
    #end

   }
  }
  finish{ambient 1}
  translate -1/2
}


Post a reply to this message

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