I started with a simple blank file named raytrace.cpp. I was determined to do everything from scratch, using no existing libraries. The first task was to create a simple blank image. Sounds easy, and it is. I decided to use the PPM file format, which is a simple pixel map file simile similar to a Windows .bmp file, but the file format is dead simple. I did not save an image from this stage of the application, it was a simple black image, completely unremarkable in every way. :)
Stage two, that is shoot out rays from camera and color object in the scene with an arbitrary color, was a bit more difficult. Being that I am not a graphics programmer, and my last math class was about 5 years ago, I had to relearn the basic concepts of vectors, rays, points, spheres matrix transforms and trig. Once I had the basics after about a week of reading in my spare time, I then had to translate that into code. At this stage the project consists of 14 files and about 350 lines of code, 550 if you include my comments. I finally got this stage kind of working last night at about 4:30 AM. With a single sphere in the scene, the current state of the project is:

The next stages are to add more spheres to the scene and add shading, then I will begin bouncing the rays and adding light sources. Stay tuned...
-Michael
No comments:
Post a Comment