Why it matters: In a world dominated by powerful GPUs from Nvidia and AMD, one self-taught coder is demonstrating that it's possible to create impressive 3D graphics from scratch. Alex Fish has released a remarkably smooth 3D engine that operates on a small homemade GPU powered by an Espressif ESP32-S3 microcontroller.
This isn't Fish's first venture into homebrew graphics. He initially developed the "Pescado" engine in WebGL for web browsers, then ported it to OpenGL for PC graphics cards. However, achieving smooth 3D rendering on a low-power microcontroller is a significant leap.
Fish's engine, dubbed "ESPescado" for the ESP32 port, is entirely handmade using C++ and OpenGL. He created the vector, matrix, and rendering math libraries from scratch. As Fish explains, "the physics and geometry processing occur in 3D, but when displaying the image on a 2D monitor, only 2D points can be plotted."
ESPescado uses perspective projection to flatten the 3D objects into 2D for the screen.
Moreover, it's quite responsive. Thanks to the ESP32's dual-core design, Fish's code can handle physics and input processing at 700 frames per second on one core, while the other core focuses on smoothly rendering wireframes at 40 fps.
The hardware itself is a hacker's dream: a compact 1.9-inch, 320 x 160 pixel display surrounded by ESP32 brains, paired with external joysticks that allow full 3D control. One joystick even attaches to your finger for an immersive experience. An accelerometer provides motion input for adjusting the in-game camera.
Also see: FuryGPU is an open source hardware GPU built from scratch
Under the hood, ESPescado utilizes the standard 3D toolkit of meshes, vertices, and matrices. Meshes, constructed from triangles of points and lines, form the basic objects and terrain seen in video games. The engine can then apply transformations like scaling, rotating, and positioning to place these meshes in the virtual 3D world.
A YouTube demo showcases ESPescado in action, with Fish manipulating a simple green triangular object against a black background. It offers a basic insight into the engine's capabilities, demonstrating that even the most fundamental 3D graphics can be developed from first principles.
For tinkerers and students of 3D math, Fish's project provides a fascinating glimpse into the core concepts behind 3D engines. Both the ESP32 "ESPescado" version and the original OpenGL "Pescado" have been released on GitHub for anyone to study and build upon.