POV-Ray Raytracer Descriptions and Examples by Friedrich A. Lohmüller
   Random with POV-Ray (Part 3)
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

Random in POV-Ray
   - RandomNumbers in Loops
   - quadratic + cubic
  > Colors + Scale
   - Tilting + Bending
   - Trees by Random
   - Include File 'rand.inc'
   - Filled height_field
   - Random Flower

  - Insert Menu Add-on
    & Download
 
                                       
 Colors and Scale by Random      

Here we show how to colorize and size a serie of objects irregularly.
For this we use a serie of spheres, which we arrange in a square or in a cube with a while loop.

Randomized Color Selection:
We choose a new serie of random numbers and replace in the previous samples the color in the texture statement i.e. as follows:

//------------------------------------
#declare Random_3 = seed (1432);
#declare Random_4 = seed (7242);
#declare Random_5 = seed (9912);
//------------------------------------
...
 pigment{ color rgb< rand(Random_3),
                     rand(Random_4),
                     rand(Random_5)> }
... etc.

 
 
 

Scene file for POV-Ray: .pov or .txt

Only rgb values between 0 and 1 are giving realistic tones of colors with full contrast in the shades.
Fine shades of colors we get if we add only smaller randomized parts to some base rgb values as follows:

//------------------------------------
#declare Random_3 = seed (1432);
#declare Random_4 = seed (7242);
#declare Random_5 = seed (9912);
//------------------------------------
...
 pigment{
   color rgb
    < 1.00 - 0.35*rand(Random_3),
      0.65 + 0.2*(-0.5+rand(Random_4)),
      0.00 + 0.75*(rand(Random_5)> }
... etc.

Scene file for POV-Ray: .pov or .txt

And now the same thing in three dimensions:


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Randomized Scaling:
Therefor we add the according random value to the scale term:


   scale < 1, 0.1+2*rand(Random_1), 1 >

 
 
 
 
 
 
 
 
 
 
 

click for higher resolution
Click on the image for a higher resolution!
Scene file for POV-Ray: .pov or .txt
 
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
top

© Friedrich A. Lohmüller, 2013
www.f-lohmueller.de