The Eye of Japetus had blinked, as if to remove an
irritating speck of dust. David Bowman had time for
just one broken sentence, which the waiting men in
Mission Control, nine hundred million miles away and
ninety minutes in the future, were never to forget:
´The thing's hollow - it goes on for ever - and -
oh my God - it's full of stars!´
From Arthur C. Clarke's "2001: A Space Odyssey"
OMGIFOS
OMGIFOS is a tool to render a high-quality, anti-aliased, motion-blurred star-field-background for the POV-Ray Raytracer.
It consists of two parts:
- A small java application
- A POV-Ray include to control it via POV-Ray
OMGIFOS can either produce random starfields or can use real star-positions taken from the Hipparcos-catalog.
HOWTO
The following files come with OMGIFOS:
omgifos.jarThe Java-application that actually renders the starfield | |
omgifos.cfgThe main configuration file. It tells OMFIGOS wheter is should create a random starfield
or use the catalog, how may stars should be rendered, and some other parameters | |
omgifos.iniA POV-Ray ini file. It tells POV-Ray to call OMGIFOS after each frame of an animation | |
omgifos.incA POV-Ray include providing some macros to controll OMGIFOS | |
demo.povA POV-Ray demo-scene. It shows how OMGIFOS can be used in a POV-Ray scene | |
README.TXTThe readme | |
LICENSE.TXTThe GNU General Public License | |
Omgifos.javaThe source-code for the Java-application | |
Let's take a look at each file:
omgifos.jar
OMGIFOS is started by
java -jar omgifos.jar [-d] <image width> <image height>
The -d is optional and tells OMGIFOS to render to the screen instead of a file. After starting it does the following:
- It reads the configuration from the omgifos.cfg file
- It reads the camera-settings from the omgifos.cam file (this file is created automatically by a POV-Ray macro in omgifos.inc)
- It renders the image and saves it as omgifos.png (or displays it if the -d switch was on)
omgifos.cfg
This is the main configuration file. It looks like:
StarSize :2
Mode :random
Sectors :7
SectorSize :1000
StarsPerSector :500
Repeat :10
RandomSeed :0
StarSize | StarSize is the size of a star in pixel. 2 is ideal for typical resolutions about 640x480.
You might want to change it to 1.5 or 1 for smaller resolutions (like 320x240) or to 3 or more for higher resolutions (like 1024x768). |
Mode | Mode can be "random" or "catalog". |
If mode is "random" the following variables need to be defined:
Sectors: | OMGIFOS divides space into cubic sectors. 3 means 3^3 = 9 secotrs, 5 meads 5^3 = 125 sectors, 7 means 7^3 = 343 sectors, etc. |
SectorSize: | The size of one sector in POV-units |
StarsPerSector: | The number of stars that should be created per sector |
Repeat: | The n-th sector will be the same as the first one. Needed for cyclic animations |
RandomSeed: | An integer between 0 and 99 to serve as a random seed |
If mode is "catalog" the following variable needs to be defined:
NumberOfStars | The number of stars that should be loaded from the catalog. Must be between 0 and 100000. |
Mode "catalog" is currently not supported!!!
You can only "fly through" random starfields - the catalog stars remain fixed at there position.
omgifos.ini
This file tells POV-Ray to call OMGIFOS after each frame. You must choose it as "ini"-file. Check the POV-Ray documentation for details.
In the Windows version of POV-Ray you can choose the init-file in the Render/Edit Settings menu. It just contains one line:
Post_Frame_Command=java -jar omgifos %w %h
If you want to use a different ini-file just include this line.
omgifos.inc
This is a POV-Ray include which provides some macros to controll OMGIFOS. The usage of the macros is best explained by
looking at the demo scene.
demo.pov
The demo scene starts with the line
#include "omgifos.inc"
This includes the file and makes the macros accessible to the parser.
Next it defines a macro callen moveCamera(clk): OMGIFOS needs to know all the camera parameters of the current and of
the last frame (the latter to perform motion-blur). Unfotunately it can't read the camera {...} block in POV-Ray, therefor
this macro should set the following global variables for the float-parameter clk (which is the clock-variable):
camAspectRatio | The screen(!) aspect ratio - e.g. 4/3 or 16/9 |
camLocation | The camera location |
camLookAt | The camera look_at point |
camAngle | The camera angle (field of view) |
camTransform | An optional transformation applied after the look_at. e.g.
#declare camTransform = transform { rotate <0,90,0> rotate <0,0,20> }
|
Next it calls some Macros:
moveCamera(clock)
omgifosSetCamera(camLocation,camLookAt,camAngle,camTransform,camAspectRatio)
moveCamera(clock + clock_delta)
omgifosSetMotion(camLocation,camLookAt,camAngle,camTransform)
writeCamera()
Theese macros move the camera into position, (moveCamera and omgifosSetCamera), then move the camera to next frames position (for
motion-blurring) and finally call writeCamera() - this will write the camera-relevant information to the file "omgifos.cam".
Calling setScreen(distance) will create a plane which displays omgifos.png (the image created by omgifos).
Here you can insert whatever Povray objects you like.
CREATING THE DEMO ANIMATION
This describes how to render the demo animation using POV-Ray for Windows 3.5
The Java Runtime Environment (JRE) version 1.4 or later must be installed on your system!
- Load the file "demo.pov"
- Omgifos needs to write to the omgifos.cam file and needs to start another program, so select Options -> Script I/O Restrictions and ensure that
"Permit Read/Write in Current Directory" is allowed (checked) and "Disable Starting Other Programs" is not checked.
- Select Render ->Animation and check "Minimize Shellouts". This will prevent the DOS commandline-boxes from popping up.
- Select Render -> Edit Settings/Render from the Main Menu, and click BROWSE in the INI File section. Now select omgifos.ini and click OPEN.
- Enter the following line in the Command Line Options textfield:
+W640 +H480 +KI0 +KF22 +KFI0 +KFF551
This tells POV-Ray the screen-resolution (640x480), the start and end clock values (0..22 seconds) and the start and end frame (0..550 @ 25 frames per second)
- Click RENDER and POV-Ray will start rendering the animation...
Note that the first image will always be empty, so don't include it if you compile the animation with and mpeg-encoder or some other tool!