ssloy/tinykaboom

A brief computer graphics / rendering course

C++

2,428

20 commits

updated Feb 22, 2023

See the code

README

KABOOM! in 180 lines of bare C++

This repository is a teaching aid for my computer graphics lectures. It is not meant to produce the ultimate or even physically realistic renders. It is meant to be simple. This project is distributed under the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE.

Check the article that accompanies the source code.

This project is closely related to my software raytracer. If you are looking for a software rasterizer, check the other part of the lectures.

In my lectures I tend to avoid third party libraries as long as it is reasonable, because it forces to understand what is happening under the hood. So, the raytracing in 180 lines of plain C++ produces this result:

compilation

git clone https://github.com/ssloy/tinykaboom.git
cd tinykaboom
mkdir build
cd build
cmake ..
make

You can open the project in Gitpod, a free online dev evironment for GitHub:

Open in Gitpod

On open, the editor will compile & run the program as well as open the resulting image in the editor's preview. Just change the code in the editor and rerun the script (use the terminal's history) to see updated images.

Homework

The possibilities are infinte. For example, you can add the environment map and some transparency:

Add other objects and illuminate them:

3d
3d-graphics
computer-graphics
c-plus-plus
cpp
fun
graphics
graphics-programming
learning
raytracer
raytracing
raytracing-engine
rendering
rendering-engine
shaders
tutorial

ssloy/tinykaboom

A brief computer graphics / rendering course

C++

2,428

20 commits

updated Feb 22, 2023

See the code

README

KABOOM! in 180 lines of bare C++

This repository is a teaching aid for my computer graphics lectures. It is not meant to produce the ultimate or even physically realistic renders. It is meant to be simple. This project is distributed under the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE.

Check the article that accompanies the source code.

This project is closely related to my software raytracer. If you are looking for a software rasterizer, check the other part of the lectures.

In my lectures I tend to avoid third party libraries as long as it is reasonable, because it forces to understand what is happening under the hood. So, the raytracing in 180 lines of plain C++ produces this result:

compilation

git clone https://github.com/ssloy/tinykaboom.git
cd tinykaboom
mkdir build
cd build
cmake ..
make

You can open the project in Gitpod, a free online dev evironment for GitHub:

Open in Gitpod

On open, the editor will compile & run the program as well as open the resulting image in the editor's preview. Just change the code in the editor and rerun the script (use the terminal's history) to see updated images.

Homework

The possibilities are infinte. For example, you can add the environment map and some transparency:

Add other objects and illuminate them:

3d
3d-graphics
computer-graphics
c-plus-plus
cpp
fun
graphics
graphics-programming
learning
raytracer
raytracing
raytracing-engine
rendering
rendering-engine
shaders
tutorial

Significant stargazers

(top 24 of 26)

Ben {chmark} Adams

2,035 followers · starred Jan 2019

Josh Perez

920 followers · starred Feb 2019

Delgan

393 followers · starred Jan 2019

Bernhard Manfred Gruber

140 followers · starred Jan 2019