Alex Fish's Pescado Delivers Smooth "3D" Rendering on an Espressif ESP32-S3
"There is no such thing as 3D graphics," Fish asserts — even as his engine is flinging objects around a 3D space on a microcontroller.
Game developer Alex Fish has released a surprisingly-fluid 3D graphics engine for Espressif's ESP32-S3 microcontroller, based on an earlier engine written for OpenGL-capable devices: Pescado.
"I built this 3D Graphics Engine originally in WebGL, then in OpenGL, and now for the ESP32," Fish writes of his work, which in its full-fat form is known as the Pescado Engine. "All the libraries, including the vector and matrix math libraries were written from scratch. The physics and geometry processing happens in 3D but when you want to display the image to your 2D monitor you can only plot 2D points.
"Thus, every 3D point is projected and squashed to the screen using a perspective projection matrix and perspective division. Although it looks 3D, it is actually 2D. There is no such thing as 3D graphics."
Having initially targeted web browsers with the WebGL variant of Pescado, then systems with an OpenGL-capable graphics cards, Fish's latest version of the project delivers smooth "3D" graphics on the LILYGO T-Display-S3, an all-in-one display-equipped development board built around the Espressif ESP32-S3 microcontroller. To this, Fish has added two SparkFun Qwiic-connected joysticks via a Texas Instruments TCA9548A I2C switch — one of which is worn around the index finger, providing a control system easily accessible by thumb — and a TDK InvenSense MPU-6050 inertial measurement unit.
Using these, Fish can control the objects on-screen manually or have them respond to the movement of the device itself — and, thanks to a combination of the performance of the ESP32-S3 and the relatively low resolution of the T-Display-S3's 1.9" 320×160 display, the engine delivers a smooth 700 frames per second for physics and IMU or joystick control calculations while rendering wireframes at up to 40 frames per second on the ESP32's second core.
Fish has released the engine on GitHub under an unspecified license; the OpenGL version of Pescado is also available on GitHub under the permissive Unlicense.
Update 03/30/24: This article has been updated to correct the framerate of the physics calculations versus the graphical rendering.