/cornellbox

Cornell Box (originally from Robert Hodgin) to demonstrate some 3D rendering concepts

Primary LanguageC++

Cornellbox inspired by Robert Hodgin

This project rebuilds the base of an art project originally created by Robert Hodgin https://roberthodgin.com

Just search on YouTube for Robert Hodgin Eyeo2012 to watch a full video showcasing his creation. The source code is available on GitHub https://github.com/flight404/Eyeo2012

Topics covered in this project

  • creating a window
  • integrating a user interface framework (ImGui)
  • hardware accelerated rendering with Metal
  • fake ambient occlusion shadows
  • matrix transformations (scale, move, rotate)
  • perspective projection
  • resizeable window
  • camera concept including rotation and movement

What you need

All you need to follow along or just build this project is:

VS Code extensions

The following VS Code extensions are also partly necessary:

How to build and run

In order to build the project clone this repository and update the submodule libs/imgui with
git submodule update --init

Then run sh build.sh ALL once to get ImGui to build into an object file. Every subsequent build only requires
sh build.sh

In order to run execute
./cornellbox

In case you close the user interface F1 brings it back.

Further links

Paper explaining quarternions: https://danceswithcode.net/engineeringnotes/quaternions/quaternions.html

An excellent explanation about how to construct a prespective projection matrix can be found here:
https://www.youtube.com/watch?v=EqNcqBdrNyI

Immediate mode user interface:
https://github.com/ocornut/imgui

Font used

The font I used to replace the standard ImGui font is Blender Pro Book
Fonts made from Web Fonts is licensed by CC BY 4.0