Skip to content

lidorY/RayTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RayTracer

Basic ray-tracing study project. This program renders 3D code defined scenes with a basic local illumination model.

For a camera, representing a "human eye", with a configuearble FOV and screen dimensions the software generates an image for the defined scene. This is done by simulating a recursive trace of light rays from the camera throughout the scene, bouncing them around and on or through the surface of objects. The recursivne depth can be configured from within the code.

Rays are categorized into 3 different types:

  • Intersection detection
  • Shadow feelers for shadowed/diffuse areas deduction
  • reflection rays, enabling reflective surfaces
  • refraction rays, enabling transparent objects

Output image is drawn as a BMP output to the console window.

Features

  • Pre-defined object classes, i.e. Spheres and Planes
    • Ray collision definition for each
    • Normal calculation for a given point
  • Ray tracing based intersection detection
    • defining object drawing order and overlapping zones
    • Translating objects mathematical representation into a 2D screen projection
  • Adaptation of Phong Illumination model for diffuse surfaces - https://en.wikipedia.org/wiki/Phong_reflection_model
    • Light and color simulation of the object surfaces based on point lights position
    • Multiple point light sources support
  • Point light shadows
    • Using intersection detection to affect the surface color, based on full or partial shadow obscure mode.
  • Refraction and Reflection based on Whitted light transport algorithm - https://dl.acm.org/doi/10.1145/358876.358882

result rt3

rt2 rt4

Building

Compiled and tested on MSVC 2019.

This code requires <Windows.h> header file! --> Windows only.

Run those commands in a CMD console inside the source folder:

mkdir build
cd build
cmake .. -G "Visual Studio 16 2019"

Future possible improvements

  • Textures and normal maps
  • Caustics
  • Global Illumination model

Releases

No releases published

Packages

No packages published