Table of Contents
Ray is a multi-threaded, real-time path tracer, written in C. Paths are traced through an octree, which can be edited at run-time, giving it sort of a “early Minecraft prototype” feel. Being my first “serious” program, it's rather primitive and can't work with complicated geometry or surface models.
I wrote the program as a part of my presentation titled “A physically accurate computer light model” for the finale of the 10th edition of the “Open Interschool Physics Contest” in 2013. I didn't win as there was way too much programming and too little physics involved. I wasn't great at presenting back then either. Nevertheless this was the first step toward choosing Optics as my field of study. And I did much better two years later with cem.
Compiling and running
The source code is available here at ray. Because this is a very old program, written back when I wasn't too experienced, compiling and running it can be a bit of a challenge. You'll probably have to figure it out yourself.
At start the program loads a world from “world” in the working directory. If it's not present, it'll generate a fractal-looking random octree. The repository includes a weird Pripyat-looking scene. Sometimes camera physics bug out, removing the world fixes the issue.
The controls are listed below.
- Use the mouse to look around, WASD to move around, space to fly up, C to fly down.
- F1 releases/locks the cursor.
- The mouse wheel adjusts the focal length (zoom level).
- Left and right mouse buttons destroy and place blocks, respectively.
- Keys Z, X, R, T, Y and U select the block type to place. In order: concrete, dirt, metal, mirror, light and banner.
- Keys 1 through 7 change the render quality (7 being the best).
- Press Q to launch a bouncy light source, F to toggle the flashlight.
- F11 renders to “offline.bmp” at a much higher resolution.