top of page

Year 1 project at BUas. January, 2022.

Raytracer

Raytracer6.png

Project Information:

  • Project type: Technical

  • Role: Programmer

  • Team Size: 1

  • Time Frame: 8 Weeks

  • Engine / Tools: C++

Project Summary:
This project was made as a part of graded assignment during my 1st year of education at BUas. This was a solo project, work done for this project included: Multithreading, BVH, Adaptive sampling​, Multiple materials, Area lights and more...

Optimization: BVH

Optimization was one of the most important aspect of this project. For this project I researched and implemented BVH using different split techniques, for example: SAH.​
Code example (creating leaf or splitting primitives at selected SAH bucket):

image.png
Raytracer7.png

The image below visualizes traversal cost of the BVH. The brighter the blue color is - the more hit checks are required to reach the object.

To further optimize BVH, I converted it into a compact representation (Linear layout in memory). After building BVH, the tree is transformed to the linear representation by a recursive flatten_bvh_tree() method, which performs a depth-first traversal and stores the nodes in memory in linear order:

image.png

On average BVH improved performance of the ray tracer by 90 times when rendering more complex scenes. Which allowed to render many primitives while maintaining sufficient performance. Example below: rendering 160.000 spheres with simple materials. 

image.png

Multiple materials

Raytracer6.png
  • Ray tracer supported multiple materials such as: Lambertian, Dielectric, Metal, Emissive, Marble-like.

  • Working on this project provided with a great opportunity to improve math and knowledge in certain areas of physics such as lighting, materials and more.

Fresnel Factor For Dielectrics:​

image.png

Multithreading: 

Multithreading was used to accelerate rendering by dividing the screen into multiple blocks (tasks) and distributing tasks between threads. 
Thread and Coordinator classes:

image.png

Depth of Field 

image.png

Implemented Depth Of Field. The effect was achieved by slightly offsetting ray's origin and direction everywhere except on the focus plane.

Multiple lights & Area Lights

Raytracer5.png

Added area lights that produce soft shadows by making light sources into spheres and casting multiple rays onto them. Average color of those multiple samples is used to color shadows.

Beer's law

Raytracer10.png

Too add more realism to dielectrics implemented Beer's law. Which makes light travelling through dielectrics lose it's attenuation based on the distance travelled through.

bottom of page