Skip to content

NISH-Original/cpu-raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Based Raytracer in C++

Overview

This project is a basic raytracer implemented in C++. A raytracer is a rendering algorithm that simulates the way light interacts with objects in a virtual scene to produce realistic images. By tracing the paths of rays of light as they travel through the scene, the raytracer can determine the color and intensity of the light that reaches the camera from each point in the scene. It is CPU-based and does not leverage any external graphics APIs (viz. OpenGL, Vulcan, etc), rather manually calculates and assigns values to the pixel buffer with math.

Features

  • Ray-Sphere Intersection: The raytracer can detect intersections between rays and spheres, which are used as the primary geometric objects in the scene.
  • Basic Reflection: The raytracer includes basic reflection calculations, enabling it to render reflective surfaces.
  • Phong Shading: The project implements Phong shading to simulate the way light reflects off surfaces, providing a more realistic rendering of objects.
  • Materials: It also supports modifying the aspects of the material such as Albedo, Roughness, and Emission for a wider variety of renderable objects.
  • Multiple Light Sources: The raytracer supports multiple light sources using emission materials, allowing for complex lighting setups and more dynamic scenes.
  • Multithreading: Optimised rendering process by dividing various chunks of the image between multiple threads to run in parallel.
  • Interactive Camera and UI: The application also has an interactive camera to move around the scene and UI to modify the objects in the scene.

Future Plans

  • Using the GPU: Leveraging the Vulcan API to use the GPU for faster render times, because the CPU is not best optimised for raytracing applications.
  • More Geometry: Adding support for various other 3D objects such as Quadrilaterals.
  • Advanced Lighting: Implementing more advanced lighting phenomena such as refraction.

Some Renders

Here are some renders from the current version of the engine:

Basic reflections:

v3_basic_reflections

Roughness with Path Tracing:

v5_denoising_path_tracing

Emission and Diffuse:

emission

emission_v2

add_spheres

About

Raytracer made from scratch in C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages