Pixel Machine: A Ray Tracer
So a friend of mine showed me a site called Pixel Machine. This guy wrote a ray tracer in one day. I looked at it and said, "Hey, I could do that." Now why I'd want to do that to anybody might be a complete mystery, but I happen to need a little brushing up on C++, so I decided to go ahead and try it out. I started this morning at 10AM or so, and we'll see how far we get today!
EDIT: I switched the order of it so the more recent entries stay up top...
By the way, you can download the latest source here.
Day 3 5:30PM
Super Sampling and Reflective Materials
Added anti-aliasing code and extended the phong material to support reflection. It now takes a while to render the image.... Also, the image to the left has blurry reflections turned on. You can see that the balls appear on the floor with a blurry reflection.
Also changed the color of the background to blue, so you can tell that the reflected material is blue.
Day 2 12:00AM
Didn't really work on it much today. Today was the big interview day. I didn't get a chance to work on it much, but here's phong materials!
1:00AM
Rested for the rest of the night. Wondering where to take this next...
12:00AM
So now we've got triangles and shadows working. There's a plane sitting under the two balls, and it doesn't look like the balls are floating in mid-air.
Also it turned out that my normals were correct but I was calculating the Light vector backwards... doh!
10:00PM
We have colored spheres!! Yay! Reminds me of old school CS courses...
So, I added a Light class, and a material class with a lambertian child. It was only after getting colored images that I realized that I had my image flipped 90 degrees sideways, and the r and b channel were flipped.
So this is two spheres, placed at 0,0,0 and 2,0,0, looking from the +z axis towards the origin. There's actually something funky going on with the red sphere, but I'll get to fixing it soon.
Next steps: Phong materials, Triangle geometry, Mesh Geometry, and Acceleration Structures! Oye so long...
7:00PM
Dinner break and work out break...no work done... I see how trying to program all day is so difficult... props to those who just blow through 10+ hours in a row straight.
4:00PM

Now to get to the guts of the program. Here's the easy part, right? *harhar*
I set up classes for all the following: Camera, Geometry (including just a Sphere for now), Vector3 class for math functions, and the Scene object (contains all geometry and lights information). I also created an intersection Record data structure that can hold all information about the object you hit in the scene.
For now, i just intersected a sphere at 0,0,0 and my camera at 5,0,0 looking towards the origin. Also for now, I just made the program return a white color if it hit anything at all, and black if it hit nothing at all. Wee, we have a circle!!
2:00PM
Lunch Break:I just wanted to say that I love Villa Pizza of Holmdel, NJ. It is the best pizza ever! There's a reason why it's been my favorite for 10+ years. Okay, end rant. Back to work.
12:00PM

Start! I figured there were two parts to writing it:
The easy part: making the ray tracer.
The hard part: doing all the setup.
So, I started off with creating a way to write out image files. I went with what the Pixel Machine did, since that was not to be the hardest thing. BMP's are "braindead" according to my friend, so I went with bmps, and I made a gradient 256x256 image.
EDIT: I switched the order of it so the more recent entries stay up top...
By the way, you can download the latest source here.
Day 3 5:30PM
Super Sampling and Reflective MaterialsAdded anti-aliasing code and extended the phong material to support reflection. It now takes a while to render the image.... Also, the image to the left has blurry reflections turned on. You can see that the balls appear on the floor with a blurry reflection.
Also changed the color of the background to blue, so you can tell that the reflected material is blue.
Day 2 12:00AM
Didn't really work on it much today. Today was the big interview day. I didn't get a chance to work on it much, but here's phong materials!1:00AM
Rested for the rest of the night. Wondering where to take this next...
12:00AM
So now we've got triangles and shadows working. There's a plane sitting under the two balls, and it doesn't look like the balls are floating in mid-air.Also it turned out that my normals were correct but I was calculating the Light vector backwards... doh!
10:00PM
We have colored spheres!! Yay! Reminds me of old school CS courses...So, I added a Light class, and a material class with a lambertian child. It was only after getting colored images that I realized that I had my image flipped 90 degrees sideways, and the r and b channel were flipped.
So this is two spheres, placed at 0,0,0 and 2,0,0, looking from the +z axis towards the origin. There's actually something funky going on with the red sphere, but I'll get to fixing it soon.
Next steps: Phong materials, Triangle geometry, Mesh Geometry, and Acceleration Structures! Oye so long...
7:00PM
Dinner break and work out break...no work done... I see how trying to program all day is so difficult... props to those who just blow through 10+ hours in a row straight.
4:00PM

Now to get to the guts of the program. Here's the easy part, right? *harhar*
I set up classes for all the following: Camera, Geometry (including just a Sphere for now), Vector3 class for math functions, and the Scene object (contains all geometry and lights information). I also created an intersection Record data structure that can hold all information about the object you hit in the scene.
For now, i just intersected a sphere at 0,0,0 and my camera at 5,0,0 looking towards the origin. Also for now, I just made the program return a white color if it hit anything at all, and black if it hit nothing at all. Wee, we have a circle!!
2:00PM
Lunch Break:I just wanted to say that I love Villa Pizza of Holmdel, NJ. It is the best pizza ever! There's a reason why it's been my favorite for 10+ years. Okay, end rant. Back to work.
12:00PM

Start! I figured there were two parts to writing it:
The easy part: making the ray tracer.
The hard part: doing all the setup.
So, I started off with creating a way to write out image files. I went with what the Pixel Machine did, since that was not to be the hardest thing. BMP's are "braindead" according to my friend, so I went with bmps, and I made a gradient 256x256 image.
