Ray-tracing from scratch

12/24/2024

One of the modules I took in third year was Computer Graphics, that’s not 3D modelling and stuff (that would be Computer Generated Imagery) - it’s about how rendering actually works.

The main piece of assessment is to develop a rasterizing/ray-tracing 3D renderer in C++, we’re only given three functions to accomplish this:

  • setPixelColour(int x, int y, int colour) where colour is a packed ARGB int.
  • clearPixels()
  • renderFrame()

We were then marked by submitting a 15 second demo render/ident

Final demo render

Some of the features you might be able to spot:

  • Refraction
  • Mirrors
  • Metals
  • Texture Mapping
  • Normal Mapping
  • Environment Mapping
  • Soft Shadows
  • Axis-aligned collisions and rigid-body physics
  • Animation
  • Flat, Gouraud, and Phong shading

Some of the features you won’t be able to see:

  • Culling of occluded triangles before rendering
  • On-screen menu to control render parameters
  • Loading of mtl and obj files
  • Custom animation storage format