RT²P - Real Time Ray Tracing Project

by Prashaanth in Circuits > Computers

17 Views, 0 Favorites, 0 Comments

RT²P - Real Time Ray Tracing Project

Screenshot from 2026-05-22 09-09-02.png

A custom-built real-time ray tracing project in the making written in C++, inspired by the foundational ideas presented in the Ray Tracing in One Weekend book series by Peter Shirley.

This project originally started as an implementation of the concepts covered in the book, but eventually diverged into a much larger experimental rendering system focused on:

  1. real-time ray traced rendering
  2. quaternion-based orientation systems
  3. fully unrestricted 6DOF camera movement
  4. interactive viewport rendering using SDL2
  5. low-level rendering architecture experimentation

The long-term goal of this project is the gradual development of a custom real-time ray tracing engine built from first principles.

Where Are We Now

Screenshot_20260523-061548.png

This project is actively in the making. This repository currently represents an early-stage foundation build of the renderer. The current implementation focuses heavily on:

  1. renderer architecture experimentation
  2. camera mathematics
  3. quaternion rotation systems
  4. interactive real-time rendering infrastructure

rather than advanced rendering features.

The codebase is intentionally being developed incrementally while documenting the process through slower-paced technical writeups and explanations here.

The repository should therefore be viewed as:

an evolving rendering-engine development project

rather than a finished renderer.

Starting Point

Screenshot_20260523-062027.png

This project was originally based on the implementation style and rendering pipeline from:

Ray Tracing in One Weekend

More specifically, at the given moment the project follows the architecture and concepts roughly up to the: "Moving Camera Code Into Its Own Class" portion of the book before diverging into custom systems.

From that point onward, several major systems were redesigned and extended independently.

Major Custom Systems

Real Time Ray Tracing project - early stage

Quaternion Mathematics System (quat.h)

One of the most important custom-built components in this project is the quaternion implementation contained in quat.h

This class was developed specifically to support unrestricted 3D rotational control for the renderer's camera system.

Features Implemented

  1. Quaternion multiplication
  2. Quaternion normalization
  3. Quaternion conjugation
  4. Axis-angle quaternion construction
  5. Vector rotation using quaternion transforms
  6. Rotation composition through post-multiplication

Why Quaternions?

The renderer originally relied on conventional rotational approaches, but the project eventually required:

  1. unrestricted camera movement
  2. local-axis rotation
  3. stable compound orientation updates

Using quaternions helped avoid common Euler-angle issues such as:

  1. gimbal lock
  2. axis-order instability
  3. accumulated rotational inconsistencies

The quaternion system now forms the mathematical foundation of the renderer's camera orientation logic.


Fully Custom 6DOF Camera System

A major focus of this project is the development of a true 6 Degrees of Freedom (6DOF) camera system.

Unlike conventional FPS-style cameras constrained by yaw/pitch movement, this implementation allows:

  1. free rotational movement
  2. intrinsic/local-axis rotations
  3. unrestricted translation in 3D space


Real-Time Interactive Rendering

Unlike the offline rendering approach used in the original educational implementation, this project introduces a real-time interactive rendering loop.

The renderer:

  1. continuously redraws frames
  2. processes keyboard input
  3. updates orientation in real time
  4. reconstructs viewport geometry every frame
  5. streams rendered pixels directly into an SDL texture

Next Steps

Screenshot_20260523-062241.png

Topics planned for deeper breakdowns and technical write-ups here include:

  1. quaternion mathematics and implementation
  2. 6DOF camera mathematics
  3. ray generation
  4. viewport reconstruction
  5. real-time rendering architecture
  6. SDL framebuffer integration
  7. rendering optimization experiments

And the GitHub repository will be updated from time to time.