prev index next |
Making
Difficult Objects
|
POV-Ray Tips,
Tricks, and Techniques |
Realistic
Starfield?
|
Steve Bennett wants a shortcut: | When doing a space-type of animation, I would like to
have a fairly realistic star-field or object field that gives the illusion
of depth, and that moves realistically. Right now I am using a laborious
hand made conglomeration of thousands of small spheres, but I can't imagine
there is not a way to generate some kind of random sphere field or any_kind_of_object
field, with randomness, turbulence, etc... anybody have a clue or the whereabouts
of a nice .inc file or way to generate this?
A look like that old windows screen saver, is what I am after...
depending on which way the camera travels or the field travels.
|
|
Rarius replies:
|
I used a small basic program to generate a POV include file
full of randomly distributed star spheres. I set the limit to about 2,000
stars within 10,000 units of the origin.
|
|
John VanSickle continues: | Heck, no need to use a separate program. You can declare
star spheres inside your pov-ray file.
#declare S0=seed(0)
sphere { z*Distance,Diameter/2
Set Distance equal to the vertical resolution of your screen, times the length of the direction vector in the camera declaration, times the Diameter you declare. For a 640x480 screen with the default camera and stars of radius 1 (diameter=2), this works out to 960. The stars occupy at least one pixel on the screen, but no more than four, and they anti-alias well. Set CameraLocation equal to the location vector of your camera. Tips for animating this: Make sure that the seed used for the rand() function is used only for positioning stars. If you move the camera during the animation, make sure the stars move with the camera. This will cause the stars to appear to be infinitely distant (which, for all intents and purposes, they are). A whole lot of stars (90%, in fact) will be out of the camera's view. You can use an #if statement to keep these stars from being declared, but this will not significantly speed rendering, even when you declare 10,000 stars. It's only worth effort if memory is tight. I put in the no_shadow keyword and the finish settings to minimize the
calculations the renderer has to make. I don't know how much time
this saves during rendering, but it's got to be doing some good.
|
|