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

https://github.com/a-voronov/computer-graphics-from-scratch

Computer Graphics from Scratch: Lightweight C++ implementation with no external libraries
https://github.com/a-voronov/computer-graphics-from-scratch

computer-graphics cpp

Last synced: about 1 year ago
JSON representation

Computer Graphics from Scratch: Lightweight C++ implementation with no external libraries

Awesome Lists containing this project

README

          

# Computer Graphics from Scratch

C++ implementation of [Computer Graphics from Scratch](https://gabrielgambetta.com/computer-graphics-from-scratch/) book for self-studying purposes.

The book is using JavaScript and HTML Canvas to implement logic and display results.
It seems to me that the easiest implementation in C++ without using any libraries, is to render results straight into the bmp files. So I've added a quick [bmp implementation](/examples/bmp.h).

## Run Examples

```
mkdir -p bin results

clang++ -std=c++17 examples/.cc -o bin/

bin/ && open results/.bmp
```

## Results

| [01 - Basic Raytracing](/examples/01-basic-raytracing.cc) | [02 - Diffuse Reflection](/examples/02-diffuse-reflection.cc) | 03 - Specular Reflection |
|---|---|---|
| ![Basic Raytracing](/results/01-basic-raytracing.bmp) | ![Diffuse Reflection](/results/02-diffuse-reflection.bmp) | |