An open API service indexing awesome lists of open source software.

https://github.com/mirzaim/ray-tracing-renderer

A ray tracing engine developed in C++ that renders realistic 3D scenes.
https://github.com/mirzaim/ray-tracing-renderer

3d-rendering computer-graphics cpp openmp path-tracing raytracing rendering

Last synced: over 1 year ago
JSON representation

A ray tracing engine developed in C++ that renders realistic 3D scenes.

Awesome Lists containing this project

README

          

## Ray Tracing Renderer

This project is a ray tracing engine developed from scratch in C++ without any external dependencies. It focuses on rendering scenes with realistic lighting and reflections, using core principles of ray tracing. The renderer supports various materials and recursive reflections, showcasing how basic geometric shapes like spheres can be accurately rendered in 3D space.


ray tracing render output

### Overview
This ray tracer implements key features including:
- Ray-sphere intersections
- Recursive reflections and refractions for realistic lighting effects
- Support for various materials like diffuse (Lambertian), metal, and dielectric (transparent)
- Anti-aliasing for smoother image quality
- Multi-threaded rendering using OpenMP (available in the `openmp-support` branch)

It was designed to explore the fundamentals of ray tracing, with additional optimizations such as OpenMP for faster performance.

### Installation

1. Clone the repository:
```bash
git clone https://github.com/mirzaim/ray-tracing-renderer.git
cd ray-tracing
```

2. Create a `build` folder for the compiled output:
```bash
mkdir build
```

3. Use the provided Makefile to compile the project:
```bash
make
```

For OpenMP support, switch to the `openmp-support` branch and compile using the same process.

### Usage

Run the ray tracer with the default scene:
```bash
./build/main > image.ppm
```

For a high-quality scene (this takes much longer and uses OpenMP for faster performance):
```bash
./build/main 1 > image.ppm
```

Open the `image.ppm` file with an image viewer to see the rendered result.

### Useful Resources

During the development of this project, I found several resources helpful in understanding ray tracing concepts and improving the implementation. The following is a list of materials I used:

1. [Ray Tracing in One Weekend](https://raytracing.github.io/books/RayTracingInOneWeekend.html)
2. [The Ray Tracer Challenge](https://pragprog.com/titles/jbtracer/the-ray-tracer-challenge/)
3. [Computer Graphics from Scratch](https://www.gabrielgambetta.com/computer-graphics-from-scratch/)