Well this is my first post in this blog. Normally I was planning to be more poetic but since I could not figured out the bug in my ray tracer and since my mind is thinking in terms of triangles rather than words, I will keep it as simple as possible.

I’ve built my ray tracer on a Macbook Pro with following CPU specifications:

2.2GHz quad-core Intel Core i7 processor (I7-4980HQ)
(Turbo Boost up to 3.4GHz) with 6MB shared L3 cache

Render times are as follows:

Rendered model simple.png in 0.148414 seconds
Rendered model simple_shading.png in 0.191162 seconds
Rendered model bunny.png in 69.194954 seconds

Here are my initial results from my ray tracer:

Simple rendering of basic shapes

Figure-1: Simple rendering of basic shapes

Simple shading

Figure-2: Simple shading of sphere

Rendered bunny model

Figure-3: Rendered bunny model with shading

As it can be seen from the last image, there are some problems in terms of triangle normals in rendered bunny mesh. I suspected that it might be because of normals of some triangles in the mesh are not properly calculated so I rendered normals as below, but still could not figured out the problem yet. I will update this post whenever I find the bug :)

Rendered normals of simple shapes

Figure-4: Rendered normals of simple shapes

Simple sphere shading

Figure-5: Rendered normals of sphere model

Rendered normals of bunny model

Figure-6: Rendered normals of bunny model


Update on 2017-03-15 ~ 2:15 AM

I finally fixed the problem in my ray tracer, YAY !!! I was trying to be smart in the mesh intersection function of my ray tracer where I return the function as soon as I find first triangle in mesh that intersects with the incoming ray.

Since I was discarding back-facing triangles in my triangle intersection method I was sure that I will end up seeing only the front facing triangles in scene and rays would intersect in one of them so first intersection would be enough. This was a silly mistake that I learned much from it, thanks to the rendered normals :)


Rendered normals of simple shapes

Figure-7: Final rendering of simple shapes

Simple sphere shading

Figure-8: Final rendering of sphere model with shading

Final rendering of bunny model

Figure-9: Final rendering of bunny model with shading