Advancement Assignment 1

Advancement assignment 1: Kdtree and Stanford bunny.

First advancement assignment was implemented on the ray tracer. When using the complete bunny model some errors show up, but still here are the results.

Time to build tree: 3.394 secs

Time to render scene: 491.510 secs

Time to render without Kdtree: over 1 hour (gave up after 1hr)


Above is the picture with the whole model. Some spots show no triangles, not really sure why. However, simpler models work just fine. Check below the same model but with half the triangles (file bunny_res2).


Note: code for ray triangle intersection and triangle box overlap based on Tomas Akenine-Möller implementations, available at

Note: code for reading ply files based on implementations available at


Checkpoint 7

Tone Reproductions added!

Ward’s operator, 10 nits


Ward’s operator, 100 nits


Ward’s operator, 1000 nits


Reinhard’s operator, 10 nits


Reinhard’s operator, 100 nits


Reinhard’s operator, 1000 nits


Checkpoint 3

For checkpoint 3, shading was added through shadow rays.

Below we have the picture of the scene with simple Phong Shading.


Next, one of the bonuses: Phong Blinn shading. Exactly the same values for the materials and light radiance where used, you can see the difference of both models.


Now another bonus, spawning arrays. I have made it possible to spaw arrays inside pixels in a grid, so inside each pixel we have 9 equally spaced rays that return color values which are averaged to get the final color of the pixel. Notice how the edges are less sharp. For this picture simple Phong illumination was used.


Last but not least, two light sources. Again, simple Phong was used.


More than two light sources can be used. It’s also possible to combine grid rays, multiple light sources and either Phong or Phong Blinn shading together. Here are just a few of the combinations for the sake of not making a huge post.

Checkpoint 1

For the first checkpoint of the Ray Tracer I am building for CSCI-711 Global Illumination, here are two pictures of the scene. Picture on the left is the scene from the expected viewpoint, the picture on the right is just the same scene from a different angle.

For the scene I’m using two spheres and a scaled cube as a floor.

The parameters of the scene:

  • Green Sphere
    • Scaled in (x, y, z) -> (0.4,0.4,0.4).
    • Translated in (x, y, z) -> (0,0.1,-2) .
  • Red Sphere
    • Scaled in (x, y, z) -> (0.3,0.3,0.3), smaller than the green on.
    • Translated in (x, y, z) -> (-0.5,-0.2,-2.5), comparing with the green one this one is to the left, below and in the back of the green sphere.
  • Floor
    • Scaled in (x, y, z) -> (3,0.1,6), small on y and large on x and z.
    • Translated in (x, y, z) -> (-0.7,-0.8,-4), below the spheres and moved a bit to the left.
  • Phong illumination model
    • Position (x, y, z) -> (0.5, 2.5, 0.0), essentially above and a little to the right of the camera
    • Intensity (x, y, z) -> (1.0, 1.0, 1.0)
    • Ambient light (x, y, z) -> (0.5, 0.5, 0.5)
  • Camera (left picture)
    • World position (x, y, z) -> (0,0,0)
    • Look at (x, y, z) -> (0.0,0.0,-1.0)