|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hello all,
I am trying to create a blob object with a number of sphere, but I am
trying to place them at random. Now the following problem occurs, all
sphere are placed at the same position. The objection, of course, is to see
all the spheres. My code is as follows:
#declare bubbles = blob
{
threshold 0.5
#declare i = 0;
#while (i<50)
#declare S = seed(3415765);
#declare X = rand(S);
#declare Y = (rand(S)*2)+0.5;
#declare Z = rand(S);
sphere { <X, Y, Z>, 0.4, 0.55
pigment { color rgb <0.8, 0.3, 0.6> }
}
#declare i = i + 1;
#end
}
Any help would be appreciated,
Koos Jan Niesink
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:01c1abbb$9437bf40$667dd383@etnica koos wrote:
> #declare bubbles = blob
> {
> threshold 0.5
> #declare i = 0;
> #while (i<50)
> #declare S = seed(3415765);
>
Mogge,
Take "#declare S = seed(3415765);" out of the while loop and put it above
"#declare bubbles=".
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks, for the help. It really works!!
I only don't get the reason why the seed declaration has to be placed
outside the while-loop.
greetings/groeten, Koos Jan Niesink
ingo <ing### [at] homenl> schreef in artikel
<Xns### [at] povrayorg>...
> in news:01c1abbb$9437bf40$667dd383@etnica koos wrote:
>
> > #declare bubbles = blob
> > {
> > threshold 0.5
> > #declare i = 0;
> > #while (i<50)
> > #declare S = seed(3415765);
> >
>
> Mogge,
>
> Take "#declare S = seed(3415765);" out of the while loop and put it above
> "#declare bubbles=".
>
>
> Ingo
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:01c1abc2$cd6f19a0$667dd383@etnica koos wrote:
> Thanks, for the help. It really works!!
Gaaf he.
> I only don't get the reason why the seed declaration has to be placed
> outside the while-loop.
#declare S= seed(7) intialises a random stream.
#declare Nr1= rand(S) takes the first random number from the stream.
#declare Nr2= rand(S) takes the second.
#declare Nr3= rand(S) the third.
Note that every time you render your scene Nr1 alway gets the same
value. Now if you put #declare S= seed(7) inside a loop, it gets
initialised every time the loop passes it. Thus the value of Nr1 will
always be the same.
Put the seed outside the loop, it is only initialised once. On the first
loop we will get the above result. On the second loop:
#declare Nr1= rand(S) takes the fourth random number from the stream.
#declare Nr2= rand(S) takes the fifth.
#declare Nr3= rand(S) the sixth.
etc.
The order of random numbers for a given seed is always the same.
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
koos <fra### [at] hotmailcom> wrote:
: I only don't get the reason why the seed declaration has to be placed
: outside the while-loop.
If you initialize the random number generator with the same value at
each loop, you'll get the same value from rand().
A line like:
#declare S = seed(0);
means: "Make S a random number stream with the initial value 0". Successive
rand(S) calls will take values from that seed (and they are always the same
values).
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ingo" <ing### [at] homenl> wrote in message
news:Xns### [at] povrayorg...
> in news:01c1abc2$cd6f19a0$667dd383@etnica koos wrote:
>
> > Thanks, for the help. It really works!!
>
> Gaaf he.
>
Dutch?
--
#local X=20*<-2,2,5>;sphere_sweep{catmull_rom_spline 6<-8,-8>1<-8,-8>1<-8,8>1<
8,-8>1<8,8>1<8,8>1translate 20*z pigment{gradient z scale 3color_map{[0rgb<0,9
,18>][1rgb 0]}}}#local K=2*z*X-X;#local R=seed(clock);blob{#while(K.x>X.x)
#local N=X+<rand(R)rand(R)1>/3;#local X=(vlength(N-K)<vlength(X-K)?N:2*X-N);
sphere{X,1,1rotate z*90}sphere{X,1,1}#end pigment{rgbt 1}interior{media{//Nekar
emission<2,4,5>*5}}hollow scale.05}// http://nekar_xenos.tripod.com/metanoia/
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 2002/01/21
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
> Dutch?
>
Ja.
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Inderdaad ;-)
thanks for the explanation
In article <Xns### [at] povrayorg>, "ingo" <ing### [at] homenl>
wrote:
> in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
>> Dutch?
>>
> Ja.
> Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Koos Jan Niesink" <koo### [at] hotpopcom> wrote in message
news:3c5e5628$1@news.povray.org...
> Inderdaad ;-)
> thanks for the explanation
>
> In article <Xns### [at] povrayorg>, "ingo" <ing### [at] homenl>
> wrote:
>
>
> > in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
> >> Dutch?
> >>
> > Ja.
> > Ingo
Dit lyk vir my daar is heelwat meer Nederlanders hier as wat ek gedink het. Ek
vermoed hier is dalk ook 'n paar Vlaams sprekendes? Verskoon my spelling - ek is
Afrikaans.
I didn't see any [NE] on the povray.international so I never looked there
again...
--
#local X=20*<-2,2,5>;sphere_sweep{catmull_rom_spline 6<-8,-8>1<-8,-8>1<-8,8>1<
8,-8>1<8,8>1<8,8>1translate 20*z pigment{gradient z scale 3color_map{[0rgb<0,9
,18>][1rgb 0]}}}#local K=2*z*X-X;#local R=seed(clock);blob{#while(K.x>X.x)
#local N=X+<rand(R)rand(R)1>/3;#local X=(vlength(N-K)<vlength(X-K)?N:2*X-N);
sphere{X,1,1rotate z*90}sphere{X,1,1}#end pigment{rgbt 1}interior{media{//Nekar
emission<2,4,5>*5}}hollow scale.05}// http://nekar_xenos.tripod.com/metanoia/
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 2002/01/21
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"koos" <fra### [at] hotmailcom> wrote in message
news:01c1abbb$9437bf40$667dd383@etnica...
<snip>
Well, you've had answers to your initial problem.
Here's a subtler trap with random streams....
#declare S1 = seed(32534);
#while(1=1)
#declare S2 = seed(rand(S1))
object{foo translate y*rand(S2)}
#end
Here, you get some variation for rand(S2), but not a lot. This is because the
seed to S2 is always in the range 0 -> 1, which returns a random stream with
very little variation.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |