|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |