|
![](/i/fill.gif) |
/* Hi Andrew,
The first picture looks much better than the second! What about shifting
the blue glow to the left to let the icons stand out more?
Aligning of rounded and non-rounded objects is difficult, only a mis-
alignment will look right. You can see this by close inspection of
characters standing on their base line: those with a round bottom
actually are slightly below the base line!
My idea to place evenly distributed random bubbles is this:
Imagine an NX*NY*NZ-array of 1*1*1-boxes. Every box either is empty or
contains one bubble with a probability P (which may depend on the position
of the box). The bubble must stay within the box, but may occupy any
position within (so the radius must be <0.5). To create more irregularity,
each "x-y-sheet" of boxes is translated by a random y amount. Each x-row
of boxes is additionally translated by a random x-amount. A complete scene
follows; just copy this whole post to POV-Ray and render it with the
command line options shown below.
Sputnik
--
----------------------------
fr### [at] computermuseum fh-kiel de
----------------------------
*/
// random bubbles
// -F +D +W800 +H600 +A0.1 +AM2 +R3
#declare NX = 8; // number of bubbles in x-direction (right)
#declare NY = 6; // number of bubbles in y-direction (up)
#declare NZ = 5; // number of bubbles in z-direction (away)
#declare Rmax = 0.3; // max. bubble radius (<0.5)
#declare Rmin = Rmax;//*0.7; // min. bubble radius (<=Rmax)
#declare Rand = seed(1234);
#declare BubbleTex = texture {
pigment { color rgb <0, .5, 1> }
finish { ambient .3 }
}
light_source { <-100, 60, -80>, rgb 1 }
camera { location -4*NX*z look_at 0 angle 20 }
// loop through NX*NY*NZ possible bubble positions
union {
#declare Z = 0;
#while (Z<NZ)
#declare Y = rand(Rand); // vary y of each x-y-plane of bubbles
#while (Y<NY)
#declare X = rand(Rand); // vary x of each x-row of bubbles
#while (X<NX)
// create a sphere with probability P
#declare P = X/NX;
#if (rand(Rand)<P)
// chose a random radius R
#declare R = Rmin+(Rmax-Rmin)*rand(Rand);
// put sphere with radius R at a random position
// completely inside box{<NX,NY,NZ>,<NX+1,NY+1,NZ+1>}
#declare ShiftMax = 1-2*R;
sphere { < X+R+ShiftMax*rand(Rand),
Y+R+ShiftMax*rand(Rand),
Z>,
R
}
#end//if
#declare X = X+1;
#end//while X
#declare Y = Y+1;
#end//while Y
#declare Z = Z+1;
#end//while Z
texture { BubbleTex }
translate -0.5*<NX+1, NY+1, 0>
}//union
// container for all possible bubbles
difference {
box { <-NX/2-0.6, -NY/2-0.6, -Rmax >, <NX/2+0.6, NY/2+0.6, NZ-0.9+Rmax > }
box { <-NX/2-0.5, -NY/2-0.5, -Rmax-0.1>, <NX/2+0.5, NY/2+0.5, NZ-1+Rmax> }
texture { pigment { color rgb <.5, 1, .5> } finish { ambient .3 } }
no_shadow
}
Post a reply to this message
Attachments:
Download 'Bubbles.jpg' (14 KB)
Preview of image 'Bubbles.jpg'
![Bubbles.jpg](/povray.binaries.images/attachment/%3C3eac9869%241%40news.povray.org%3E/Bubbles.jpg?preview=1)
|
![](/i/fill.gif) |