|
![](/i/fill.gif) |
W0RLDBUILDER <nomail@nomail> wrote:
> I have an idea for a random starfield but I have no idea how I'm going to pull
> it off. My idea is to start out with a sphere filled with emissive media, then
> scatter hundreds of them around the scene out to a certain distance. The only
> problem is, how am I supposed to place 500 sphere objects randomly using
> rand.inc?
You don't need rand.inc for that. You can do something like:
#declare Star = /* your star object here */;
#declare Amount = 500;
#declare Seed = seed(0); // Try integer values other than 0 for other
// distributions
#declare MinExtent = <-100, -100, -100>;
#declare MaxExtent = <100, 100, 100>; // Modify as desired
#declare Index = 0;
#while(Index < Amount)
object
{ Star
#declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
translate MinExtent + (MaxExtent - MinExtent) * RandVector
}
#declare Index = Index + 1;
#end
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |