Contents

Raytracer

During my first Recurse Center retreat in the fall of 2021, I learned Python (and just a little React), worked on code craftsmanship, and poked around to learn a bit about any aspects of computing I happened across during study sessions or while pairing with fellow Recursers. One tangent led me to writing a ray tracing engine.

GPUs rule

In the course of exploring photorealistic image generation for movies and games, I discovered that the practical execution of algorithms which simulate realistic (physics-based) illumination is made possible by phenomenal advances in dedicated hardware, supported by machine learning.

No GPU, no problem… (?)

I wrote my ray tracer in Python since that was the language I was learning at the time. The logic simulates in-scene light interactions, including diffuse surface scattering (Lambertian) and reflection/refraction (Fresnel, computed recursively).

/images/example_shadowsdiffuse.png
Raytracing from scratch in Python

The code isn’t performance optimized, nor architected to leverage GPU capabilities. I nonetheless got a rapid fire intro to real world implementations of ray and path tracing - there’s some extremely cool research in that space!

… really, though - you need GPUs

Realistic images at high frame rates for games rely on innovative approaches stitched together to meet stringent technical constraints, and exquisite animations and special effects in movies are made possible by a combination of advanced hardware and software supported by dedicated computer clusters (aka render farms). And both applications depend on sophisticated GPU platforms optimized for ray tracing. In the hands of skilled artists, this incredible technology generates delightfully photorealistic images and animations.


This post was originally published in 2021 on an earlier version of this website.