POV-Ray Raytracer Descriptions and Examples by Friedrich A. Lohmüller
   Random with POV-Ray   (Part 8)
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
 
                                       
 A Random Flower with 'rand.inc'      

  For this scene we are using the following function:
  VRand_On_Sphere(Stream)
  The vector of a random point on a unit-radius sphere{<0,0,0>,1}.

#include "rand.inc" // random functions
// 'Reorientate_Trans' needs:
#include "transforms.inc"
#declare Random_1 = seed (23528);
//-----------------------------------------
union{
 #local Nr = 0;     // start
 #local EndNr = 150; // end
 #while (Nr < EndNr)

 // differ a bit form spherical position:
 #local RandScale=(1+0.1*rand(Random_1));
 #local Position =
   RandScale * VRand_On_Sphere(Random_1);

 union{ // inner union
  cone{<0,0,0>>, 0.02, Position, 0.01
    texture{
      pigment{ color rgb<0.75,0.5,0.3>}
      normal { bumps 0.5 scale 0.05}
      finish { phong 1 }
    } // end of texture
  } //---------------
  sphere{<0,0,0>, 0.1  //, 1.5
          scale<1,0.5,1>// y orientated
   // turn in direction to Position:
    Reorient_Trans(<0,1,0>, Position )
    translate Position // move to Position
    texture{
      pigment{ color rgb<1,0.15,0>}
      normal { bumps 0.5 scale 0.05 }
      finish { phong 1 }
    } // end of texture
  } //---------------
 } // end inner union

 #local Nr = Nr + 1;  // next Nr
 #end // --------------- end of loop
 translate<0,1.25,0>
} // end of union
//-----------------------------------------
See scene file for more details!
Flower with VRand_On_Sphere
With random factor 0.1 .
Flower with VRand_On_Sphere
With random factor 0.3 .
Scene file for POV-Ray:  
VRand_On_Sphere_2.pov
   
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
top

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