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:
  1. A small java application
  2. 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.jar
  • The Java-application that actually renders the starfield
  • omgifos.cfg
  • The 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.ini
  • A POV-Ray ini file. It tells POV-Ray to call OMGIFOS after each frame of an animation
  • omgifos.inc
  • A POV-Ray include providing some macros to controll OMGIFOS
  • demo.pov
  • A POV-Ray demo-scene. It shows how OMGIFOS can be used in a POV-Ray scene
  • README.TXT
  • The readme
  • LICENSE.TXT
  • The GNU General Public License
  • Omgifos.java
  • The 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:
    1. It reads the configuration from the omgifos.cfg file
    2. It reads the camera-settings from the omgifos.cam file (this file is created automatically by a POV-Ray macro in omgifos.inc)
    3. 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
    
    StarSizeStarSize 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).
    ModeMode 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:
    NumberOfStarsThe 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):
    camAspectRatioThe screen(!) aspect ratio - e.g. 4/3 or 16/9
    camLocationThe camera location
    camLookAtThe camera look_at point
    camAngleThe camera angle (field of view)
    camTransformAn 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!

    1. Load the file "demo.pov"
    2. 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.
    3. Select Render ->Animation and check "Minimize Shellouts". This will prevent the DOS commandline-boxes from popping up.
    4. Select Render -> Edit Settings/Render from the Main Menu, and click BROWSE in the INI File section. Now select omgifos.ini and click OPEN.
    5. 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)
    6. 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!