Ray Trace - Reflection & Refraction

Images of Reflection:

Refraction: Working to correct black dots in the image.

Ray Trace - Area Light and soft shadows

Point lights: In order to check the light intersection with object, we need to fire only one ray in the direction of the point light from the currently intersected point.

Area Light: Area light work differently from the point light. As in area light we need to generate more rays towards the geometry representing area light. Hence, a lot more rays are required for the calculation of light.

While implementing area light, I randomly sampled over 9 points on the area light. However, the result is not good. Following image is generated using area light with 9 sample points:

In order to correct it, more samples are required. However, every time I increase the number of samples from 9 to any number greater than that, my CUDA crashes giving error.

Still trying to resolve the issue.

Ray Tracer - Specular Highlights

Specular Highlight:
Specular highlight is the shiny spot that appears on the shiny surface when illuminated.

To calculate: 
If the direction of reflected light becomes equal to the direction of eye then we see a surface point P highlighted.

Ray Trace - Shadows

Shadow implementation process in Ray tracer:
To generate shadows, we need to traverse all the light sources and find if there is any object  between  currently intersected object and the light. If, there is an object then the object is in shadow and we do not need to calculate the color of that pixel.

Ray Tracing - CUDA

Ray Tracing Algorithm:

The ray-tracing is a technique that generates image by parsing through each pixel on the screen and calculating color of each pixel on screen. Hence, for each pixel a ray is shot into the scene. The direction of ray is the line tracing from the eye to the center of the pixel. Using the ray Origin and ray direction, we perform various intersection tests to check if the ray intersects any object in the scene. In some scenarios, the ray will intersect more than one object. So, we select the intersection point which is closest to the eye i.e. origin of the ray. Also, we shoot another ray from the intersection point towards the light. If this ray does not intersect with any object on its way to the light, the hit point is illuminated with the color of the light multiplied by material color of the object. If it does intersect with another object, then that pixel of object comes under shadow.