|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi all -
I'm working on a solar system image right now, and im having trouble with
the asteroid belt. I've tried a media - filled cone, and a while loop to
place random spheriods. (see code below)
So really, I have 3 questions -
1) is there a way to adjust the while loop so that it generates the spheres
inside the boundries of the cone?
2) i know Tek used an asteroid belt pigment in one of his IRTC entries. Does
anyone have the source code for this pigment or something similar that I
could use?
3) Anyone have any other ideas for this project?
Thanks,
OpalPlanet
(i know the scales and colors of both of these are odd, they're all
placeholders, sorry)
//media filled cone
cone { <0 0, 0>, 0 // Center and radius of one end
<127,0, 0>, 30.0 // Center and radius of other end
rotate<0, 0,0>
pigment{rgbt 1}
hollow
interior{
media {
emission .1
density {
bozo density_map {
[.51 rgb <0, 0, 1> warp{ turbulence .5} ]
}//end density map
}//end density
}//end media
}//end interior
}//end cone
//randomly-generated spheres
#declare xp = seed(0);
#declare yp = seed(0);
#declare zp = seed(0) ;
#declare rad = seed(3);
#declare xs = seed(4) ;
#declare ys = seed(5);
#declare zs = seed(6) ;
#declare xr = seed(7) ;
#declare yr = seed(8) ;
#declare zr = seed(9) ;
#declare n = 0;
#while (n<20000)
sphere{<1000+rand(xp),1000+rand(yp),1000+rand(zp)>, rand(rad)
scale<rand(xs),rand(ys),rand(zs)>
rotate<rand(xr),rand(yr),rand(zr)>
pigment{Green}}
#declare n = n+1;
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
OpalPlanet wrote:
> 1) is there a way to adjust the while loop so that it generates the spheres
> inside the boundries of the cone?
the brute force method would be to create random spheres like
you do now and then only keep those which lie inside the cone.
This has the advantage that it works with any shape, and the
object pattern should help you there.
Of course, you can also parametrize the cone in such a way that
a uniform distribution in the parameter space leads to a uniform
distribution in the cone, but it may not be worth the bother ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
OpalPlanet nous apporta ses lumieres en ce 2007/07/09 16:29:
> Hi all -
> I'm working on a solar system image right now, and im having trouble with
> the asteroid belt. I've tried a media - filled cone, and a while loop to
> place random spheriods. (see code below)
>
> So really, I have 3 questions -
>
> 1) is there a way to adjust the while loop so that it generates the spheres
> inside the boundries of the cone?
>
> 2) i know Tek used an asteroid belt pigment in one of his IRTC entries. Does
> anyone have the source code for this pigment or something similar that I
> could use?
>
> 3) Anyone have any other ideas for this project?
>
> Thanks,
> OpalPlanet
>
>
>
I'd use the following steps:
1 - randomly chose a point along the axis of your cone
2 - randomly chose a radius, adjust that acording to your location along the axis
3 - randomly chose an angle from 0 to 360 and rotate your location around the axis
4 - place one asteroid at that location, and check that it don't intersect
another one. Use an array to store the locations.
5 - every 50 to 100 elements, place a dummy asteroids that have been prescaled
to twice or trice the dimention of the asteroid, make them part of an union.
6 - on subsequant iterations, check if you are "inside" that union to prevent
part of the possible intersections.
If your placement is sparce, there will be very few intersecting asteroids and
the placement process will be fast.
--
Alain
-------------------------------------------------
Bend the facts to fit the conclusion. It's easier that way.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 1) is there a way to adjust the while loop so that it generates the
>> spheres
>> inside the boundries of the cone?
> I'd use the following steps:
> 1 - randomly chose a point along the axis of your cone
> 2 - randomly chose a radius, adjust that acording to your location along
> the axis
> 3 - randomly chose an angle from 0 to 360 and rotate your location around
> the axis
> 4 - place one asteroid at that location, and check that it don't intersect
> another one. Use an array to store the locations.
> 5 - every 50 to 100 elements, place a dummy asteroids that have been
> prescaled to twice or trice the dimention of the asteroid, make them part
> of an union.
> 6 - on subsequant iterations, check if you are "inside" that union to
> prevent part of the possible intersections.
>
> If your placement is sparce, there will be very few intersecting asteroids
> and the placement process will be fast.
There is a macro for this in rand.inc
VRand_In_Obj(Object, Stream)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I have the feeling that I'm missing something obvious, so excuse me if this
is a stupid question :-), but...
Why are you filling a cone to simulate an asteroid belt?
Wouldn't a flattened torus be more appropriate?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Bill Pragnell nous apporta ses lumieres en ce 2007/07/10 05:40:
> I have the feeling that I'm missing something obvious, so excuse me if this
> is a stupid question :-), but...
>
> Why are you filling a cone to simulate an asteroid belt?
> Wouldn't a flattened torus be more appropriate?
>
>
In fact, a long cylinder, possibly flatened, would be a good aproximation in
most closeup cases. The cone can be used to produce a kind of forced
perspective, but then, you need to adjust the scaling of the asteroids to the
radius of the cone at the asteroid location.
--
Alain
-------------------------------------------------
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain <ele### [at] netscapenet> wrote:
> In fact, a long cylinder, possibly flatened, would be a good aproximation in
> most closeup cases. The cone can be used to produce a kind of forced
> perspective, but then, you need to adjust the scaling of the asteroids to the
> radius of the cone at the asteroid location.
Ah yes, I get the idea. I'm too much of a physical purist! (So I won't even
mention the mean separation of asteroids in our own belt... :)
If you don't mind a slower render time, you could use an isosurface. Take a
pigment function like crackle, then vary the threshold (as a constant in
the function {} block) as 1/r or something similar, where r is the distance
from the cylinder/cone's axis.
For a sphere, you end up with something like this:
http://www.infradead.org/~wmp/gallery5/iso1.jpg
Of course, the threshold here goes from 0 -> 1, so cut it off to leave the
rocks spaced out at the centre.
Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks for all the ideas, guys. I'm new at this, so I'm not quite sure how
to use the macro - how do I use the point it returns as the position for
the spheres?
Also, The reason I'm using a cone (which is situated so the axis is
perpendicular to the line of veiw) is because the main belt actually
stretches from about Earth's orbit out to Jupiter, with most of the
asteroids between Mars and Jupiter. I'm trying to give this impression with
a cone, so that the narrow point (at earth) has a few asteroids, and then
the broad part of the cone is in the "belt" itself, between Mars and
Jupiter.
Thanks again!
OpPl
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> Alain <ele### [at] netscapenet> wrote:
> > In fact, a long cylinder, possibly flatened, would be a good aproximation in
> > most closeup cases. The cone can be used to produce a kind of forced
> > perspective, but then, you need to adjust the scaling of the asteroids to the
> > radius of the cone at the asteroid location.
> Ah yes, I get the idea. I'm too much of a physical purist! (So I won't even
> mention the mean separation of asteroids in our own belt... :)
>
> If you don't mind a slower render time, you could use an isosurface. Take a
> pigment function like crackle, then vary the threshold (as a constant in
> the function {} block) as 1/r or something similar, where r is the distance
> from the cylinder/cone's axis.
>
> For a sphere, you end up with something like this:
> http://www.infradead.org/~wmp/gallery5/iso1.jpg
>
> Of course, the threshold here goes from 0 -> 1, so cut it off to leave the
> rocks spaced out at the centre.
>
> Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hey All -
I figured it out, thanks for the suggestions!
I promise to post images once this project gets a little farther along.
-OpPl
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I'd use the following steps:
> 1 - randomly chose a point along the axis of your cone
> 2 - randomly chose a radius, adjust that acording to your location along
> the axis
> 3 - randomly chose an angle from 0 to 360 and rotate your location around
> the axis
> 4 - place one asteroid at that location, and check that it don't intersect
> another one. Use an array to store the locations.
Isn't that method going to produce more asteroids per unit volume near the
narrow end of the cone, and also near the axis of the cone?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|