Features List

We implemented the following features in our ray tracer.

Lighting

We implemented four different types of light, Ambient Light, Point Light, Directional Light and Spotlight.

Materials

We implemented phong, matte and reflective materials. For perfectly specular materials, the diffuse component is zero, while for perfectly diffuse or matte material, the specular component is zero. A combination of specular and diffuse components produces phong material.

BRDF's

We used the Bi-Directional Reflectance Distribution Function(BRDF's) to compute how light is reflected at surfaces. We implemented Lambertian, Glossy Specular and Perfect Specular.

Shadows

All our implemented light sources support shadows through the concept of secondary ray generation. Shadows can be switched off/on in build functions.

Acceleration Structures

We implemented Oct-Tree as our acceleration structure.

Camera

Both parallel and perspective viewing is supported in our raytracer.

Primitives

Our raytracer supports planes, triangles, spheres and boxes as the basic geometric primitives.

Anti-Aliasing

For smoothing out edges, we implemented regular and random samplers in our raytracer. Multiple rays are shot per pixel producing a much nicer interpolation in the colors assigned to each pixel. Regular sampling, involves a fixed number of rays for each pixel in our case, 16.

Bonus Features

A list of implemented bonus functionalities is given below.

OBJ Loader

Our ray tracer supports loading scenes as .obj file. A mesh or any scene consisting of multiple meshes can simply be first exported to .obj format through a 3D software and can then simply be loaded into our ray tracer.

Blender Correspondence

We used Blender for modelling and exporting our concept scene.Any scene that can be viewed in Blender can be directly loaded as an .obj in our raytracer. the scene was rotated such that the camera is looking into the positive y direction, this is the view that was rendered in our final raytracer.

Acceleration Structures For a Scene With Spheres

The following tables compare the render times of our ray tracer with and without acceleration grids. The rendering was done on a hardware with following configurations:

  • Processor: Ryzen 5 1600 (6c/12t)
  • RAM: 16 GB @3000MHz
  • System Type: 64-bit Operating System - Windows 10

Comparison Times

Time With Oct Tree Time Without Oct Tree Number of Primitives (triangles) Resolutions
Time With Oct Tree Time Without Oct Tree Number of Primitives (triangles) Resolutions
6.102 3.618 10 1920 x 1920
14.896 16.542 100 1920 x 1920
49.21 173.202 1000 1920 x 1920
550.12 2200+ 1000 1920 x 1920
0.349 0.288 10 400 x 400
0.806 1.013 100 400 x 400
3.855 7.895 1000 400 x 400
8.042 78.332 10000 400 x 400

Rendered Images

  • All
  • Ray-Casting
  • Lights&Shadows&Materials
  • Anti-Aliasing

Monkey Mesh

Reflective Material- Whitted Tracing

Reflective Material- Whitted Tracing

Directional Light - Matte Material - Shadows

Ambient Light

Point Light - Matte Material - Shadows

Point Light - Directional Light - Matte Material - Shadows

Point Light - Directional Light - Phong Material

Point Light - Shadow

Anti - Aliasing

Build Files

buildLights_Shadows.cpp

This scene consists of a box, triangle and sphere of matte material with different lights.

buildPhong.cpp

This scene consists of a box, triangle and sphere of phong material with different lights.

buildHelloWorld_v1.cpp

This scene This scene was already provided, modified it; now consists of a sphere and plane with different lights.

buildChapter14.cpp

This scene was already provided, we modified it to take care of anti-aliasing.

reflectiveHelloWorld.cpp

This is the scene with reflective sphere and whitted tracer.

reflectiveChapter14.cpp

This scene was already provided, but we modified it with reflective materials and whitted tracer.

buildMesh.cpp

This scene renders a monkey with primitives as triangles.

Team



Ammar
CS 2022
Akeel Ather Medina
CS 2023
Hafsa Irfan
CS 2023
Muhammad Jazib Bhatti
CS 2022



Credits

The textbook, "Raytracing from the Ground Up", by Kevin Suffern and the accompanying code snippets.
Professor Waqar Saleem, the course instructor.