POV-Ray : Newsgroups : povray.general : Random Colour picker for spheres : Re: Random Colour picker for spheres Server Time
14 Aug 2024 05:16:18 EDT (-0400)
  Re: Random Colour picker for spheres  
From: Bill Bohan
Date: 23 Feb 1998 03:40:01
Message: <34F135E0.CF9C0B02@technologist.com>
Zack,

Somewhere before your loop you need to seed a random generator:

#declare R1 = seed(0)

In your switches you need the rand function:

#switch (int(rand(R1)*3.999999 ))  // gives 0 to 3

Then you need to use your cx and cy values to set the colors for your spheres.
Also I noticed your syntax is not what POV is expecting. It needs to see lines
like:

#declare color1 = pigment{Orange}

and

       #case (0)
        cx = pigment{color1}

then you can set your colors like this:

  sphere { <sin(loop_iterator) -5,loop_iterator,loop_iterator>,1 pigment {
cx } }

I hope this helps.
Bill Bohan
http://www.dhc.net/~bilbohan
--
As many programmers as there are, that's how many ways there are to do it.


Post a reply to this message

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