POV-Ray : Newsgroups : povray.general : to make a plane with random drops of water Server Time
31 Jul 2024 06:12:00 EDT (-0400)
  to make a plane with random drops of water (Message 1 to 4 of 4)  
From: MrLoft
Subject: to make a plane with random drops of water
Date: 8 Nov 2007 07:20:00
Message: <web.4732fecbfb42efd7ffc57d0f0@news.povray.org>
Hi everyone,

I wish to make a plane with random drops of water.
The random insue is about translating drops and scalind them.

I'm a 'rookie' and I've reached so far by reading documentation,
but I can't go any further.

Random translating is ok, but I can't change the shape of the drops randomly.

Any help from the experts :-) whould be apreciated.


Thanks in advence
Mr Loft


// --------------------
// This is the code
// --------------------

// ==== Standard POV-Ray Includes ====
#include "colors.inc"  // Standard Color definitions
#include "textures.inc"  // Standard Texture definitions
#include "functions.inc"  // internal functions usable in user defined functions
#include "rand.inc"   // random number generation macros


// perspective (default) camera
camera {
  location  <0.0, 20, 0.0>
  look_at   <0.0, 0.0,  -1.0>
  right     x*image_width/image_height
}


// create a regular point light source
light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <-20, 40, -20>
}

// An area light (creates soft shadows)
// WARNING: This special light can significantly slow down rendering times!
light_source {
  0*x                 // light's position (translated below)
  color rgb 1.0       // light's color
  area_light
  <8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z)
  4, 4                // total number of lights in grid (4x*4z = 16 lights)
  adaptive 0          // 0,1,2,3...
  jitter              // adds random softening of light
  circular            // make the shape of the light circular
  orient              // orient light
  translate <40, 80, -40>   // <x y z> position of light
}


// Create an infinite sphere around scene and allow any pigment on it
sky_sphere {
  pigment {
    gradient y
    color_map {
     [0.0 color rgb <0.7,0.7,1.0>]
     [1.0 color blue 0.5]
    }
  }
}

// An infinite planar surface
// plane {<A, B, C>, D } where: A*x + B*y + C*z = D
plane {
  y, // <X Y Z> unit surface normal, vector points "away from surface"
  0 // distance from the origin in the direction of the surface normal
  pigment {
   color Red
  }
  hollow off // has an inside pigment?
}

// ----------------------------------------
// Scene objects
// ----------------------------------------

#declare Blister =
sphere {
 <0, 0, 0>, 2
 texture {
    pigment{ rgbf <1.0, 1.0, 1.0, .9> }
    normal {
        ripples 1
        frequency 10
    }
    finish {
        reflection {0.3, 1 fresnel}
        // conserve_energy
    }
}
}

// ------------------------------------------
// Copies

#declare NxRd = seed (23574);
#declare NyRd = seed (22846);
#declare NzRd = seed (24784);

union {
 #declare FVPos = -100;
 #declare LVPos = 100;

  #while ( FVPos < LVPos + 1)

   #declare FHPos = -100;
   #declare LHPos = 100;

    #while ( FHPos < LHPos + 1)

     object {
      Blister
      normal {
       spotted
       turbulence 10*rand(RdmC)

      }
      translate <5*FHPos+(4*rand(RdmA)), -1.75, 5*FVPos+(4*rand(RdmB))>
      scale <0.2*NxRd, 0.2*NyRd, 0.2*NzRd>
     }

    #declare FHPos = FHPos + 1;
   #end
  #declare FVPos = FVPos + 1;
 #end
}


Post a reply to this message

From: Rarius
Subject: Re: to make a plane with random drops of water
Date: 8 Nov 2007 09:34:28
Message: <47331e74$1@news.povray.org>
MrLoft,

You seem to be misunderstanding the SDL random keywords and how to use 
them...

    #declare NxRd = seed (23574);
    #declare NyRd = seed (22846);
    #declare NzRd = seed (24784);

    ...

    scale <0.2*NxRd, 0.2*NyRd, 0.2*NzRd>

You are multiplying by the identifier of a random stream, not a random 
number... You need to change the "scale" line to read as follows:

    scale <0.2*rand(NxRd), 0.2*rand(NyRd), 0.2*rand(NzRd)>

Personally I would only use a single random stream, rather than three.

Rarius


"MrLoft" <abo### [at] gmailcom> wrote in message 
news:web.4732fecbfb42efd7ffc57d0f0@news.povray.org...
> Hi everyone,
>
> I wish to make a plane with random drops of water.
> The random insue is about translating drops and scalind them.
>
> I'm a 'rookie' and I've reached so far by reading documentation,
> but I can't go any further.
>
> Random translating is ok, but I can't change the shape of the drops 
> randomly.
>
> Any help from the experts :-) whould be apreciated.
>
>
> Thanks in advence
> Mr Loft
>
>
> // --------------------
> // This is the code
> // --------------------
>
> // ==== Standard POV-Ray Includes ====
> #include "colors.inc"  // Standard Color definitions
> #include "textures.inc"  // Standard Texture definitions
> #include "functions.inc"  // internal functions usable in user defined 
> functions
> #include "rand.inc"   // random number generation macros
>
>
> // perspective (default) camera
> camera {
>  location  <0.0, 20, 0.0>
>  look_at   <0.0, 0.0,  -1.0>
>  right     x*image_width/image_height
> }
>
>
> // create a regular point light source
> light_source {
>  0*x                  // light's position (translated below)
>  color rgb <1,1,1>    // light's color
>  translate <-20, 40, -20>
> }
>
> // An area light (creates soft shadows)
> // WARNING: This special light can significantly slow down rendering 
> times!
> light_source {
>  0*x                 // light's position (translated below)
>  color rgb 1.0       // light's color
>  area_light
>  <8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z)
>  4, 4                // total number of lights in grid (4x*4z = 16 lights)
>  adaptive 0          // 0,1,2,3...
>  jitter              // adds random softening of light
>  circular            // make the shape of the light circular
>  orient              // orient light
>  translate <40, 80, -40>   // <x y z> position of light
> }
>
>
> // Create an infinite sphere around scene and allow any pigment on it
> sky_sphere {
>  pigment {
>    gradient y
>    color_map {
>     [0.0 color rgb <0.7,0.7,1.0>]
>     [1.0 color blue 0.5]
>    }
>  }
> }
>
> // An infinite planar surface
> // plane {<A, B, C>, D } where: A*x + B*y + C*z = D
> plane {
>  y, // <X Y Z> unit surface normal, vector points "away from surface"
>  0 // distance from the origin in the direction of the surface normal
>  pigment {
>   color Red
>  }
>  hollow off // has an inside pigment?
> }
>
> // ----------------------------------------
> // Scene objects
> // ----------------------------------------
>
> #declare Blister =
> sphere {
> <0, 0, 0>, 2
> texture {
>    pigment{ rgbf <1.0, 1.0, 1.0, .9> }
>    normal {
>        ripples 1
>        frequency 10
>    }
>    finish {
>        reflection {0.3, 1 fresnel}
>        // conserve_energy
>    }
> }
> }
>
> // ------------------------------------------
> // Copies
>
> #declare NxRd = seed (23574);
> #declare NyRd = seed (22846);
> #declare NzRd = seed (24784);
>
> union {
> #declare FVPos = -100;
> #declare LVPos = 100;
>
>  #while ( FVPos < LVPos + 1)
>
>   #declare FHPos = -100;
>   #declare LHPos = 100;
>
>    #while ( FHPos < LHPos + 1)
>
>     object {
>      Blister
>      normal {
>       spotted
>       turbulence 10*rand(RdmC)
>
>      }
>      translate <5*FHPos+(4*rand(RdmA)), -1.75, 5*FVPos+(4*rand(RdmB))>
>      scale <0.2*NxRd, 0.2*NyRd, 0.2*NzRd>
>     }
>
>    #declare FHPos = FHPos + 1;
>   #end
>  #declare FVPos = FVPos + 1;
> #end
> }
>
>


Post a reply to this message

From: Trevor G Quayle
Subject: Re: to make a plane with random drops of water
Date: 8 Nov 2007 12:15:00
Message: <web.473343a755ec4e01c150d4c10@news.povray.org>
"Rarius" <rar### [at] rariuscouk> wrote:
> MrLoft,
>
> You seem to be misunderstanding the SDL random keywords and how to use
> them...
>
>     #declare NxRd = seed (23574);
>     #declare NyRd = seed (22846);
>     #declare NzRd = seed (24784);
>
>     ...
>
>     scale <0.2*NxRd, 0.2*NyRd, 0.2*NzRd>
>
> You are multiplying by the identifier of a random stream, not a random
> number... You need to change the "scale" line to read as follows:
>
>     scale <0.2*rand(NxRd), 0.2*rand(NyRd), 0.2*rand(NzRd)>
>
> Personally I would only use a single random stream, rather than three.
>
> Rarius

Sometimes multiple streams are convenient if you want your randomness consistent
(even if that sounds contradictory).  In this case, it may be of use to have the
x/y/z translations on the same stream (however, I can also see reason not to).
But I would certainly put the scaling seed on a separate stream so it doesn't
interfere with the translations.

From what I can tell in your scene, you should also make sure you scale the
object before translating it (unless that is your intention), as scaling after
causes the translation to essentially get scaled as well (all scaling is
relative to the origin).

-tgq


Post a reply to this message

From: Alain
Subject: Re: to make a plane with random drops of water
Date: 9 Nov 2007 17:49:12
Message: <4734e3e8$1@news.povray.org>
MrLoft nous apporta ses lumieres en ce 2007/11/08 07:19:
> Hi everyone,
> 
> I wish to make a plane with random drops of water.
> The random insue is about translating drops and scalind them.
> 
> I'm a 'rookie' and I've reached so far by reading documentation,
> but I can't go any further.
> 
> Random translating is ok, but I can't change the shape of the drops randomly.
> 
> Any help from the experts :-) whould be apreciated.
> 
> 
> Thanks in advence
> Mr Loft
> 
> 
> // --------------------
> // This is the code
> // --------------------
> 
> // ==== Standard POV-Ray Includes ====
> #include "colors.inc"  // Standard Color definitions
> #include "textures.inc"  // Standard Texture definitions
> #include "functions.inc"  // internal functions usable in user defined functions
> #include "rand.inc"   // random number generation macros
> 
> 
> // perspective (default) camera
> camera {
>   location  <0.0, 20, 0.0>
>   look_at   <0.0, 0.0,  -1.0>
>   right     x*image_width/image_height
> }
> 
> 
> // create a regular point light source
> light_source {
>   0*x                  // light's position (translated below)
>   color rgb <1,1,1>    // light's color
>   translate <-20, 40, -20>
> }
> 
> // An area light (creates soft shadows)
> // WARNING: This special light can significantly slow down rendering times!
> light_source {
>   0*x                 // light's position (translated below)
>   color rgb 1.0       // light's color
>   area_light
>   <8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z)
>   4, 4                // total number of lights in grid (4x*4z = 16 lights)
>   adaptive 0          // 0,1,2,3...
>   jitter              // adds random softening of light
>   circular            // make the shape of the light circular
>   orient              // orient light
>   translate <40, 80, -40>   // <x y z> position of light
> }
> 
> 
> // Create an infinite sphere around scene and allow any pigment on it
> sky_sphere {
>   pigment {
>     gradient y
>     color_map {
>      [0.0 color rgb <0.7,0.7,1.0>]
>      [1.0 color blue 0.5]
>     }
>   }
> }
> 
> // An infinite planar surface
> // plane {<A, B, C>, D } where: A*x + B*y + C*z = D
> plane {
>   y, // <X Y Z> unit surface normal, vector points "away from surface"
>   0 // distance from the origin in the direction of the surface normal
>   pigment {
>    color Red
>   }
>   hollow off // has an inside pigment?
> }
> 
> // ----------------------------------------
> // Scene objects
> // ----------------------------------------
> 
> #declare Blister =
> sphere {
>  <0, 0, 0>, 2
>  texture {
>     pigment{ rgbf <1.0, 1.0, 1.0, .9> }
>     normal {
>         ripples 1
>         frequency 10
>     }
>     finish {
>         reflection {0.3, 1 fresnel}
>         // conserve_energy
>     }
> }
> }
> 
> // ------------------------------------------
> // Copies
> 
> #declare NxRd = seed (23574);
> #declare NyRd = seed (22846);
> #declare NzRd = seed (24784);
> 
> union {
>  #declare FVPos = -100;
>  #declare LVPos = 100;
> 
>   #while ( FVPos < LVPos + 1)
> 
>    #declare FHPos = -100;
>    #declare LHPos = 100;
> 
>     #while ( FHPos < LHPos + 1)
> 
>      object {
>       Blister
>       normal {
>        spotted
>        turbulence 10*rand(RdmC)
> 
>       }
>       translate <5*FHPos+(4*rand(RdmA)), -1.75, 5*FVPos+(4*rand(RdmB))>
>       scale <0.2*NxRd, 0.2*NyRd, 0.2*NzRd>
>      }
> 
>     #declare FHPos = FHPos + 1;
>    #end
>   #declare FVPos = FVPos + 1;
>  #end
> }
> 
> 
It's always beter to translate after you scale, unless you want your scaling to 
also affect the translation.
I'd scale ass follow:
scale<rand(NxRd), rand(NyRd), rand(NzRd)>*0.2
OR
scale<rand(NxRd), rand(NxRd), rand(NxRd)>*0.2 // no need to use separate streams 
here.
Multiplying the translation vector is the same as multiplying each components 
separately.
I'd also use only one stream for the translate.

-- 
Alain
-------------------------------------------------
EVERYTHING HAS A GENDER

You may not know this but many nonliving things have a gender...

A Web Page is Female, because it's always getting hit on.


Post a reply to this message

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