Thursday, October 23, 2008

Updates

I've made significant progress and will be updating this blog more frequently in the future to document my progress. I've successfully integrated the Qt framework into the raytracing application at this point. This allows me to write the GUI once and have it work across different platforms. In addition I am making use of the Qt's image file and concurrency faculties, again these work across different platforms without me having to change the code.

The render pipeline has been updated to use Qt's concurrent map function, which I am using to map each (x,y) point I need pixel information for to a render pixel function. Qt will take care of multi-threading under the hood for me, which saves me lots of headaches.
The GUI now has close, load, render, stop, and save buttons. Unfortunately stop needs work, although I call the cancel method on the cuncurrent map process it will not stop until it is done rendering even if the application has closed. This is a pretty big issue that I hope to resolve soon. Load is a work in progress, I rather dislike having to recompile each time I change the scene's build function, so I decided to create a file parsing class to build the scene given a text file as input which will eliminate the need to recompile for each change in scene allowing for faster testing and development. It's not done yet, but it's coming along nicely. Render starts the threaded rendering process for the current scene and updates the display to show render progress. Save, opens a file dialog and lets you save the rendered image as a .png file, a useful addition without which the only way to save an image was to do a printscreen and paste into an image editor.
I've spent at least 6 hours on this in the past 2 days, now if only I could put that much time into my math homework!

Tuesday, September 30, 2008

Outputing Images

today I've been trying to get the PNGwriter library working. I haven't worked with the commandline of g++ much and make is being a pain, but I think I'm getting close. Eventually I'll be able to output to a PNG file, and it's platform independent.

Monday, September 29, 2008

Class structure

For my first attempt I followed the book Raytracing from the Ground Up by Kevin Suffern, and I followed his structure as he laid it out. This time I'm going to try my own way, first up: Have a single parent 3D math construct class from which things like vectors, points and such are derived.

The Proposal

(this is incomplete, I forgot the antialiasing details)

AN EXPLORATION OF C++ THROUGH RAYTRACED RENDERING

Summary:
This project centers around a raytracer, an application which renders a visual representation of a geometric shape in 3 dimensions. The implementation will be in C++ for the purpose of learning both the C++ language and the fundamentals of computer graphics. This study could be considered a merger of the classes Computer Science 4 and Computer
Graphics II. 

Deliverable:
The final application will be a cross-platform application which can render an arbitrary 'scene' to an image file. The coding involved covers many aspects of C++ and general programming. The application is a large and complex project spanning over a hundred files of code. The architecture and implementation of the application is based upon the raytracer detailed in the textbook 'Ray Tracing from the Ground Up' by Kevin Suffern.
A scene is made up of one or more geometric objects, either in perfect mathematical form or tesselated triangle form defined directly in the scene file or as a .PLY file. 
A scene also includes the type, location, and direction of the virtual camera from which the scene is rendered. The type of camera will define how rendering rays originate within the scene. The three camera types are: orthographic, pinhole-perspective, and simulated lens. The simulated lens will alter the path of rays to simulate focus or 'depth of field'
Scenes also contain lights which illuminate objects within the scene. A light can be of the following types: point, directional, area, environment, ambient, or be an emmissive material on an object. Lights can have different colors and intensities. Lights can also cast shadows, emmisive objects cast soft shadows. The ambient light can illuminate all objects equally or variably as per ambient occlusion. 
Each object has a material which is made up of two bidirectional reflectance distribution functions, BRDFs, which define how light interacts with a surface. A material has a color, and may be be glossy reflective; mirror reflective; phong reflective; or perfectly diffuse.

Evaluation and expectations:
The project is considered correct and complete if it successfully does what has been outlined above, follows a consistent coding style, and is appropriately documented. The application will be able to to closely approximate the 'cornell box' render target, less diffuse-diffuse light transport.   graphics.cornell.edu/online/box/compare.html
The student will meet with the faculty sponsor every two weeks to discuss the progress that has been made and to focus continued progress. The project will involve a minimum of 100 man-hours of work on the part of the student.

Tools

I will be using the following tools:
Editor: gVim
Version Control: Mercurial
Documentation: Doxygen

It Starts...

I've created this blog mainly for the purpose of publicly documenting my progress of an independent study project in Computer Science. The project is a raytracer written in C++, more information will be forthcoming. I hope to routinely update this blog.