Bisqwit's raytracing

0. Contents

   1. Non-povray
   2. Povray scenes
      2.1. Balls
      2.2. Unowns
      2.3. Machine
      2.4. Lego triangle
      2.5. Tetris animation
      2.6. Bell
      2.7. Radiosity test
      2.8. Descent cave run
   3. Pending ideas

1. Non-povray

First, I have been doing some raytracing programs on my own.
They have their own web pages, so I'll not cover them here.
image
bsptest

image
oddfract

These helped me understanding how raytracing works, thanks to sensei Warp. :)

2. Povray scenes

See the POV-Ray official site if you are new to POV-Ray.

2.1. Balls

Much like everyone else probably, I started doing spheres. Lighted as beautifully as possible.
Warp was helping a lot in my many questions.
image image
These are not very skillful as you can see, but it was a nice start anyway.

2.2. Unowns

Unowns are mystical lettershaped Pokémon creatures in the Pokémon universe.
In Pokémon 3 the movie there's a scene with thousands of Unowns swirling in magical looking spirals and circles, shaping the reality.
This looked very cool.
I wanted to make a similar scene.

So here I started with animations. There are several more images and two 1-2 MB avi files in the directory.

One thing I noticed: It is quite difficult to ensure no collisions happen when objects are moving.

2.3. Machine

FF5 ancient dungeon (These images are from FF5, not my own)
In Final Fantasy V, there is an ancient highly technical (but sort of weird) place that has funny music.
You can listen to it here (64 kB SPC file).

So this got me an idea.
First I made a mathematical map of the music, to synchronize the video with the music and to invent meanings for all sounds.
The map consisted of items like this: I syncronized the povray clock with the music clock and set the clock/framerate to sync with commandline.
The images above are from the game, but these are mine:
screenshot 1 screenshot 2 screenshot 3
There are three 4-7 MB avi files available.

2.4. Lego triangle

lugnet logo I was browsing Lugnet, and I got an idea to replicate their logo with povray.
Warp once made a beautiful impossible triangle scene and it used orthogonal projection, but I wanted to do it with perspective projection.
I succeeded.
Some spoilers available at the right.
The source code is also available.
spoiler
spoiler
spoiler

2.5. Tetris animation

This was exciting.
The project consisted of several parts:
- povray script to simulate a tetris field.
I made this kind of macroes:
  • #macro addblock(blocktype, xpos, ypos, rotation)
    Adds a tetris block to the scene, rotated in the specified angle.
  • #macro eraseline(linenumber, clockpos)
    Destructs one block line of the scene: Clips the scene to upper half and bottom half, explodes the block in between and moves the top half a bit downwards. Clock position given.
  • This made it easy to define a field. Example:
    addblock(L1, 0,areaheight-3, 90)
    addblock(V, 2,areaheight-1, 0)
    addblock(K, 5,areaheight-2, 180)
    addblock(S1, 7,areaheight-2, 0)
    addblock(L1, 2,areaheight-3, 0)
    addblock(S2, 4,areaheight-4, 0)
    addblock(S2, 7,areaheight-4, 0)
    addblock(L1, 2,areaheight-5, 90)
    addblock(V, 1,areaheight-8, 90)
    eraseline(areaheight-2, 0)

    The downside of this was that it made the rendering crawling slow. Despite of my best efforts to optimize the scene so that there were never invisible objects in unions, some frames of the animation ate hundreds of megabytes of memory (which of 70% was swap) and ate hours of rendering time. Seems like povray sucks at unions.
- music.
Years ago I wrote a music (MidiS3M with Scream Tracker 3) which seemed to fit quite well in this animation. I rebooted to Windows, played and recorded the music, returned to Linux and encoded it as mp3.
- sound effects.
The sound effects were MIDI instruments which I recorded the same way as the music.
- mixer.
This program is available for everyone to share: streamixer.
The program inputs a list of samples and timestamps to play and then mixes them together at the specified times.
- tetris computer player.
The first time I have implemented a genetic algorithm.
I made a tetris game engine, then implemented a computer player to calculate the next move.
The computer player judges all possible moves and picks the best.
The problem was how to judge which move is the best.
So I assigned various properties:
  • How many windows horizontally
  • How many windows vertically
  • How tall heaps
  • How thin/deep pits
  • etc.
The program had some initial values for each of those properties. The computer modified each of them a little and played games using each of these scoresets. Those scoresets which survived best, were minorly altered and those which survided worst, were majorly altered. This was repeated for hundreds of games, hundreds of iterations, hundreds of scoresets, until I was satisfied with a computer player that played 100 times better than with my initial scoring values.
Next the computer player was only needed to play one game and save the actions of the game to a file.
- scene generator
This program reads the saved game produced by the computer player, and converts it into two files:
  • Povray script (addblock, eraseblock...)
  • Mixer script
- makefile
A Makefile to combine all of these into a serie of thousands of .tga files.
Finally the .tga files were joined to a single .avi file with animmaker; the soundtrack was encoded to mp3 with LAME and these two were combined to a divx encoded .avi file with Mencoder.




Several avi files (0.7-6.5 MB) are available.
Please don't use download accelerators to download them.

2.6. Bell

For some reason, I just wanted to make a bell object. Be it liberty bell or church bell.
bells
This was the first time I have used the povray standard includes and the sky_sphere statement.

<Warp> Now that you have made a church bell, you only need to build a cathedral around it.

2.7. Radiosity test

Just a simple radiosity demonstration.
no radiosity
The only light sources in the scene are in the ceiling. The columns are extraluminar, but not light sources.
(They are actually blue, but they are *very* extraluminar.)
with radiosity
With radiosity enabled, two effects are observable: Walls are lit indirectly (see the back corridor), and the extraluminar columns cast their light (ambient level 10) everywhere smoothly, like area lights.
recursion_limit is 4, which is pretty excess: lower levels do almost the same thing.
Higher recursion levels add some precision, but slow down a lot.
Admitted, this is a bad demonstration. Somewhat cheating.
As the second image shows, the extraluminar pillars are actually light sources. They light almost the entire scene. They just are not defined in the standard way.
The radiosity feature of POV-Ray is intended to give depth to the image (indirect lighting), but it can be used this way too.

2.8. Descent cave run

I wanted to parse Descent (PC game) level 1 map and render it using POV-Ray. This is an animation. The flying route is automatically and randomly generated.

Download video file (MKV): descent_render.mkv (84 MiB).

3. Pending ideas


Updates:
2003-04-11 by Bisqwit

You may copy these images (given that proper credit is given), but don't link to/embed them at your pages. This is my server, and I can't afford serving images for other people's webpages.