Skip to content

A simple C++ raytracing engine developed for academic purposes in Habib University's CS 440 Computer Graphics coursework. Implements fundamental raytracing techniques to render stunning 3D scenes, including features like materials, lights, acceleration structures, and more.

License

Notifications You must be signed in to change notification settings

aliasgharchakera/raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raytracer

Description

This is a raytracing engine written in C++.

Features

Geometric primitives

  • Sphere
  • Plane
  • Triangle

Materials

  • Phong
  • Matte
  • Cosine

Lights

  • Point light
  • Ambient light
  • Spot light

Camera

  • Perspective camera
  • Parallel camera

Anti-aliasing

  • Simple sampling
  • Regular sampling
  • Random sampling
  • Jittered sampling

Acceleration structures

  • Uniform grid
  • Bounding volume hierarchy

Build

Requirements

  • C++ compiler

Instructions

git clone
cd raytracer

Custom Script (Windows)

./run.bat buildName

Manual

g++ raytracer.cpp tracer/*.cpp cameras/*.cpp geometry/*.cpp lights/*.cpp materials/*.cpp samplers/*.cpp acceleration/*.cpp utilities/*.cpp world/*.cpp build/"build%source_file%".cpp -o a.exe

./a.exe

The raytracer will output a ppm file in the raytracer folder. To convert the ppm file to a png file, run the following command:

python convert.py $source_file

Examples

Babar Azam

The following image was rendered using the following settings:

  • 1000 x 1000 resolution
  • Jittered sampling
  • 25 samples per pixel
  • Grid acceleration structure
  • Perspective camera
  • Phong material

by running the following command:

./run.bat BabarAzam

drawing

Hello World

The following image was rendered using the following settings:

  • 400 x 400 resolution
  • Simple sampling
  • 1 sample per pixel
  • No acceleration structure
  • Perspective camera
  • Cosine material

by running the following command:

./run.bat HelloWorld

drawing

Acknowledgements

About

A simple C++ raytracing engine developed for academic purposes in Habib University's CS 440 Computer Graphics coursework. Implements fundamental raytracing techniques to render stunning 3D scenes, including features like materials, lights, acceleration structures, and more.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages