|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> 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
Thanks. Would that work if I copy/pasted it several times for different types of
stars?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Warp<war### [at] tagpovrayorg> wrote:
>> 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
>
> Thanks. Would that work if I copy/pasted it several times for different types of
> stars?
>
>
Yes, just don't copy this statement, or change the value:
#declare Seed = seed(0);
If you copy it, you'll reinitialise the random stream and all new
objects will land in exactly the same locations as the previous ones.
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
W0RLDBUILDER <nomail@nomail> wrote:
> > #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
> Thanks. Would that work if I copy/pasted it several times for different types of
> stars?
Better to use a macro for that, like:
#macro CreateStars(StarObject, Amount, Seed)
#local MinExtent = <-100, -100, -100>;
#local MaxExtent = <100, 100, 100>; // Modify as desired
#local Index = 0;
#while(Index < Amount)
object
{ StarObject
#declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
translate MinExtent + (MaxExtent - MinExtent) * RandVector
}
#local Index = Index + 1;
#end
#end
#declare Seed = seed(0);
CreateStars(Star1, 100, Seed)
CreateStars(Star2, 100, Seed)
CreateStars(Star3, 100, Seed)
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> W0RLDBUILDER <nomail@nomail> wrote:
> > > #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
>
> > Thanks. Would that work if I copy/pasted it several times for different types of
> > stars?
>
> Better to use a macro for that, like:
>
> #macro CreateStars(StarObject, Amount, Seed)
> #local MinExtent = <-100, -100, -100>;
> #local MaxExtent = <100, 100, 100>; // Modify as desired
>
> #local Index = 0;
> #while(Index < Amount)
> object
> { StarObject
> #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
> translate MinExtent + (MaxExtent - MinExtent) * RandVector
> }
> #local Index = Index + 1;
> #end
> #end
>
> #declare Seed = seed(0);
> CreateStars(Star1, 100, Seed)
> CreateStars(Star2, 100, Seed)
> CreateStars(Star3, 100, Seed)
>
> --
> - Warp
I can't get that to work. I know I'm doing something wrong here. It's probably
not a good idea to drop a macro on top of a semi-n00bish casual user who just
wants to place some random stars. :-P
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Warp<war### [at] tagpovrayorg> wrote:
>> W0RLDBUILDER<nomail@nomail> wrote:
>>>> #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
>>
>>> Thanks. Would that work if I copy/pasted it several times for different types of
>>> stars?
>>
>> Better to use a macro for that, like:
>>
>> #macro CreateStars(StarObject, Amount, Seed)
>> #local MinExtent =<-100, -100, -100>;
>> #local MaxExtent =<100, 100, 100>; // Modify as desired
>>
>> #local Index = 0;
>> #while(Index< Amount)
>> object
>> { StarObject
>> #declare RandVector =<rand(Seed), rand(Seed), rand(Seed)>;
>> translate MinExtent + (MaxExtent - MinExtent) * RandVector
>> }
>> #local Index = Index + 1;
>> #end
>> #end
>>
>> #declare Seed = seed(0);
>> CreateStars(Star1, 100, Seed)
>> CreateStars(Star2, 100, Seed)
>> CreateStars(Star3, 100, Seed)
>>
>> --
>> - Warp
>
> I can't get that to work. I know I'm doing something wrong here. It's probably
> not a good idea to drop a macro on top of a semi-n00bish casual user who just
> wants to place some random stars. :-P
>
>
You only need to copy the macro definition and the macro calls into your
scene. Make sure that the calls are placed after the macro definition.
The only thing missing here, is the definitions for "Star1", "Star2" and
"Star3".
You can:
- #declare all star objects before the calls to CreateStars()
- #declare the star objects before each individual call. In this case,
you can reuse the same name.
- Define the star object inside the call itself.
In the lase case, you can use this:
CreateStars(sphere{0,0.1 pigment rgb<1,0.5,0.2>finish{ambient 1 diffuse
0}}, 100, Seed)
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain <aze### [at] qwertyorg> wrote:
> > Warp<war### [at] tagpovrayorg> wrote:
> >> W0RLDBUILDER<nomail@nomail> wrote:
> >>>> #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
> >>
> >>> Thanks. Would that work if I copy/pasted it several times for different types of
> >>> stars?
> >>
> >> Better to use a macro for that, like:
> >>
> >> #macro CreateStars(StarObject, Amount, Seed)
> >> #local MinExtent =<-100, -100, -100>;
> >> #local MaxExtent =<100, 100, 100>; // Modify as desired
> >>
> >> #local Index = 0;
> >> #while(Index< Amount)
> >> object
> >> { StarObject
> >> #declare RandVector =<rand(Seed), rand(Seed), rand(Seed)>;
> >> translate MinExtent + (MaxExtent - MinExtent) * RandVector
> >> }
> >> #local Index = Index + 1;
> >> #end
> >> #end
> >>
> >> #declare Seed = seed(0);
> >> CreateStars(Star1, 100, Seed)
> >> CreateStars(Star2, 100, Seed)
> >> CreateStars(Star3, 100, Seed)
> >>
> >> --
> >> - Warp
> >
> > I can't get that to work. I know I'm doing something wrong here. It's probably
> > not a good idea to drop a macro on top of a semi-n00bish casual user who just
> > wants to place some random stars. :-P
> >
> >
>
> You only need to copy the macro definition and the macro calls into your
> scene. Make sure that the calls are placed after the macro definition.
>
> The only thing missing here, is the definitions for "Star1", "Star2" and
> "Star3".
>
> You can:
> - #declare all star objects before the calls to CreateStars()
> - #declare the star objects before each individual call. In this case,
> you can reuse the same name.
> - Define the star object inside the call itself.
>
> In the lase case, you can use this:
>
> CreateStars(sphere{0,0.1 pigment rgb<1,0.5,0.2>finish{ambient 1 diffuse
> 0}}, 100, Seed)
>
>
>
> Alain
Never mind, I got it to work with the first method in this thread. The stars I'm
using are in an include file, stars.inc. My include file #declares all the star
objects I'm using. I also managed to get a nebula.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 10/01/2010 01:19 PM, Alain wrote:
> In the lase case, you can use this:
>
> CreateStars(sphere{0,0.1 pigment rgb<1,0.5,0.2>finish{ambient 1 diffuse
> 0}}, 100, Seed)
... or as of v3.7beta38 (if using radiosity) finish { emission 1 diffuse
0 }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
W0RLDBUILDER <nomail@nomail> wrote:
> > #macro CreateStars(StarObject, Amount, Seed)
> > #local MinExtent = <-100, -100, -100>;
> > #local MaxExtent = <100, 100, 100>; // Modify as desired
> >
> > #local Index = 0;
> > #while(Index < Amount)
> > object
> > { StarObject
> > #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
> > translate MinExtent + (MaxExtent - MinExtent) * RandVector
> > }
> > #local Index = Index + 1;
> > #end
> > #end
> >
> > #declare Seed = seed(0);
> > CreateStars(Star1, 100, Seed)
> > CreateStars(Star2, 100, Seed)
> > CreateStars(Star3, 100, Seed)
> >
> > --
> > - Warp
> I can't get that to work. I know I'm doing something wrong here. It's probably
> not a good idea to drop a macro on top of a semi-n00bish casual user who just
> wants to place some random stars. :-P
Obviously you have to #declare Star1, Star2 and Star3 to be your desired
star objects because the CreateStar() lines.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|