Simple, Lua-based 3D renderer

Hi all. Some time ago I decided that I wanted to learn how 3D rendering worked. I had just gotten my playdate in the mail, and it just seemed like the perfect place to try building a small prototype.

I'm sharing the code here. It is currently 100% Lua. Perhaps it will provide another useful reference (among the many, many already out there) for anyone building a 3D renderer, and at least give you some idea of what the performance for a naive Lua implementation might look like on the Playdate (spoiler: not great! :grin:).

Here's what it currently looks like, running in simulator. It supports movement using the D-Pad, and turning using the crank:

interaction

The same scene runs at about 2 - 3 FPS on-device, and a little higher if you turn off shadows. Compiling is straightforward, but I'm attaching the pdx file here as well: fak3d.pdx.zip (451.2 KB)

11 Likes