Skip to content

DorianBDev/Raytracing

Repository files navigation

Raytracing image

Raytracing

This project contains:

  • Basic raytracing,
  • Multithreading
  • Unit testing,
  • Lights (directional, punctual, spot),
  • Colorized lights,
  • Objects (sphere, plane, triangle),
  • Reflection,
  • Refraction,
  • SFML Window,
  • Continuous integration (see Github Actions),
  • Transparency,
  • Recursivity,
  • Movable camera,
  • SSAA anti-aliasing,
  • OBJ loading,
  • Config file for objects in parameters,
  • Modern c++ (c++17).

Multithreading

To enable multithreading, please go to the "Config.h" file.

Template

This project uses the cpp-template of Dorian Bachelot.

Build

Dependencies

  • CMake 3.12.0 or newer,
  • Conan,
  • Python (optional).

Quick start

Firstly, clone this repository (help here).

For Linux (debian-like)

Install dependencies:

> sudo apt-get install cmake g++ python
> sudo pip install conan

Build (in the 'build' folder, for example):

> cmake ..
> make

Binaries are in the 'build/bin' folder.

For Windows

Install dependencies:

Build (in the 'build' folder, for example):

> cmake ..
> cmake --build .

Binaries are in the 'build/bin' folder.

For MacOS

Install dependencies (we will use Homebrew here) :

> brew install python
> brew install conan

Build (in the 'build' folder, for example):

> cmake ..
> cmake --build .

Binaries are in the 'build/bin' folder in the bundle ".app" format.

File format

To initialize the objects and lights, you need to specify the config file path. The '|' are replaced by blank space in the file.

The file can contains these objects and lights :

  • Color definition : defined name | undefined r g b

  • Vector definition : x y z

  • Structure definition : metal reflectivity | transparent reflectivity refractivity transparency

  • Punctual format : Name | Intensity | Color | Vector Coordinates

  • Spot Format : Name | Intensity | Color | Vector Coordinates | Vector direction | Angle

  • Directional Format : Name | Structure type | Color | Vector Coordinates A | Vector Coordinates B | Vector Direction

  • Shere Format : Name | Structure type | Color | Vector Coordinates | Radius

  • Plane Format : Name | Structure type | Color | Vector Coordinates | Vector Normal

  • Model Format : Name | Structure type | Color | File model path | Vector Coordinates | Vector Angle | Scale

License

MIT license. See LICENSE.TXT for details.

About

Simple Raytracing engine in modern cpp.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published