A simple raytracer written in Java. It supports rendering spheres and triangles in any color. It also supports reflections and specular highlights. It does not support textures. The output is written to a bmp file.
The first iteration of the raytracer was only able to detect collisions and report the collided object’s color. This means that the spheres appear only as circles.

The next step to improve the image is to add shading so the spheres appear as three dimensional objects. However, this has taken a turn for the worse. The shading calculations involve raising the intensity of the light at a point on the surface to a high power, but the result was not clamped causing all kinds of striations and funky patterns.

Once clamping is applied to the output, the shading appears correctly. The light source can be repositioned to the other side.
The previous images allowed light to pass through other objects when determining the light level on the surface of another object. This means that no shadows are cast by other objects in the scene. This is solved by casting another ray to the light source to determine if it is blocked
Another improvement is to allow reflections. When a ray hits the surface, another ray is cast to determine the color of the reflected object. This is mixed in to the color of the object itself depending on the reflectivity.
Finally, triangles can be added as a geometric primitive to allow intricate scenes.

More details can be found in the repository linked above.