So for Computer Science 210 we had to write a raytracer in the C programming language. Here I will outline what I did, and some cool things that eventually got added.
Raytracer Version One:
In the beginning there was...... Circles, Planes and Ambient lighting, probably the lamest lighting in the world, but I was proud. Yes very proud.
Unfortunately I don't have any pictures from the original raytracer. Consider yourself lucky.
Raytracer Version Two
OK so now things started to get a little more interesting. We added some diffuse lighting, which made the spheres actually look like spheres and not circles. We added support for lights and lighting which brought about shadowing. Then we implemented polygons, mainly triangles and rectangles. THis made for some cool stuff, but the pictures still kinda look like crappage.
Not to bad I would say? But still, nothing spectacular.
Raytracer Version Three:
So now were getting into the GOOD stuff. For this raytracer we had to implement, at the very least, plain old perfect reflection and specular lighting. As well as anti-aliasing. Besides that we could implement some stuff of our own choice
While reflections are pretty cool, it still didn't look awesome. So I went on a research bent about lighting, and looked up some stuff about Phong Illumination, and then Phong-Blinn Illumination. Basically it's a more accurate lighting method than the plain jane stuff in the above image, it accounts for specular highlights on reflective surfaces. So I implemented Phong-Blinn and voila!
That looks a little better, nice highlight, but we need MORE!!!
So next I decided I needed something different, most people had smooth everything! Smooth surfaces, smooth shading, smooth lighting, smooth textures etc. This is not in any way how the real world is, so to add some roughness to my work, I went on a search for some good old fashioned Perlin Noise. Perlin noise is the greatest thing ever for texturing, raytracing, and a ton of other things. It's basically a smooth pseudo-random function that can be extended into n dimensions. Once I got a nice Perlin noise function working, I used it for EVERYTHING, to change the color, to change the shapes, to make bump maping. Here is an example of six octaves of Perlin noise:
Basically it looks like clouds right? Well if you use those clouds to randomly change the specular and diffuse lighting, as well as color, then you got some interesting pictures. Here is an example of some spheres that have noise applied to them in a variety of ways:
Now thats cool, also note the normal mapped wall in the background. THis was done by using perlin noise to differ the normals of the plane.
So after this I implemented cylinders, this was fairly easy, but then I implemented some very interesting forms of cylinders. The cool thing about cylinders is that you can vary the radius using a function and make very interesting shapes. SO I made the radius a function of noise which made these cool pillars.
Something very cool about these abstractified cylinders is that they are different shapes at different positions (since their functions of (x,y,z) ). So if you like how the cylinder looked in one area, you could apply a transform matrix to the cylinder and move it wherever you wanted. These
stone pillars are first noise radius, then they have a bumpapped noise layer applied to the surface.
So once these features were implemented I needed a final picture. Here was my first attempt:
Pretty dang cool. Everything has some noise applied to it in some way, the wierd spherical cylinders are just cylinders with a radius of cos(y).
The interesting x-like structures on the table and crowning the sphere are both cylinders with a VERY weird equation as the radius. I wanted something a little different, so then I did these pictures:
Heres another one: