Now that we have reflection in our scene, we can go ahead and add refraction. The computation for refractions is based on snell’s law and is a bit more complex than reflections, but nonetheless, since we already have our raytracer setup to spawn additional rays, it’s not too difficult to add support. Below is our scene with transmission enabled to make a glass-like sphere:
Thursday, January 27, 2011
Ray Tracer Part Five: Reflectivity (and recursive tracing)
The next part of our raytracer involves adding in reflectivity to objects, which extends our raytracer to a recursive raytracer. This means that for each ray shot into our scene, we may end up tracing more to resolve reflections or (soon to be) transmissions (refractions) in our scene. Below shows the result of adding a reflective surface to our scene:
Tuesday, January 18, 2011
Mid-Quarter Update
Wednesday, January 12, 2011
Ray Tracer Part Four: Procedural Shading
Since we have completed the basic shading stage of our raytracer, we are able to move on to more advanced concepts such as texture mapping. In this case, we are not using textures from files, but rather, procedurally generated textures, which we will map to our surface using calculated u,v coordinates.
On the left, you can see the procedurally shaded floor using a procedural shader which generates a color in a tile-pattern. The calculation simply detects if the position is an even or odd row/column and returns the correct color. On the right, you can see a slightly more interesting shader which simply calculates the difference between the center point of a square area and returns a color based on the distance from it. If the point is outside of the circles radius, we color it yellow, otherwise, black.
Tuesday, January 4, 2011
Ray Tracer Part Three: Basic Shading
Once we finish detecting the objects correctly from part two, we can move on to shading. For this part, I have implemented a multi-light system with Phong and Phong-Blinn illumination models.
From left to right: Single-light with Phong shading, Multi-light with Phong shading, Multi-light with Phong-Blinn shading