Raytracer

C++ project to render scenes from json specifications

This Raytracer program, written in C++, supports:

  • Full Phong Lighting Model
  • shadows
  • reflections
  • textures
  • super sampling
  • Cel-shader (a.k.a. Toon-shader)
  • Gooch shader

The objects supported are:

  • sphere
  • triangle
  • quad
  • plane
  • cylinder (with caps)
  • triangle meshes
Some examples of rendered scenes. On the left, some sphere rendered with the Phong lighting model. In the middle, the same scene is rendered with the Toon-shader. On the right right, a sphere is rendered with a texture.

The scenes to be rendered are read from a .json file, which contains the details of each model to be rendered. Using some additional scripts, it’s possible to render more complex scenes. For example, below there is a render of a DNA helix, with some H2O molecules floating around in random positions.

A scene showing a DNA helix and H2O molecules.

The script also supports non-photorealistic shading, which are toon-shading and cell-shading, as shown in some example images below.

A scene showing a DNA helix and H2O molecules, rendered with Toon shading.
A scene showing a DNA helix and H2O molecules, rendered with the non-photorealistic Gooch shading.