Skip to content

C++ implementation of an image ray tracer introduced in the Ray Tracing -book series

License

Notifications You must be signed in to change notification settings

aleksi-kangas/raytracing

Repository files navigation

Ray Tracing in C++

C++ implementation of an image ray tracer introduced in the Ray Tracing -book series.

Motivation

In order to learn about the essential math and things related to ray tracing, I decided to follow the great Ray Tracing -book series and implement my own version of the ray tracer. I followed the general logic and structure of the books, but took some liberty in certain areas. I have an interest in transforming the code into CUDA some day for acceleration purposes. Thus, I have made some critical architectural design changes, such as avoiding virtual functions altogether.

Features & Architectural Differences

  • Graphical User Interface

    • Allows easy adjustment of the renderer's settings and show a live preview of the rendering process.
    • Using ImGui as the GUI library and OpenGL as the backend.
  • Multi-Threaded C++ Renderer

    • Accelerated rendering using multiple CPU cores via a thread pool.
  • No runtime polymorphism (i.e. virtual functions)

    • Runtime polymorphism is largely present in the book, and understandably so. It does make the code simpler to understand and easier to implement. But it comes with cost of virtual function overhead at runtime.
    • Instead, I've opted to use Curiously Recurring Template Pattern (CRTP) for compile-time polymorphism (CTP).

The Next Week

About

C++ implementation of an image ray tracer introduced in the Ray Tracing -book series

Topics

Resources

License

Stars

Watchers

Forks