A software 3D renderer written in Lua, running on LuaJIT + SDL3 (primary) or Love2D (alternative backend). Implements triangle rasterization, z-buffering, perspective-correct texture mapping, and multi-light shading — entirely in Lua with no native rendering pipeline.
- Scanline rasterizer with barycentric coordinate interpolation
- Z-buffer depth testing
- Backface culling
- Perspective-correct UV texture mapping
- Gouraud (per-vertex) and flat shading
- Multi-source diffuse lighting (3 directional lights + ambient)
- OBJ and STL (ASCII) model loading
- BMP texture loading
LuaJIT + SDL3 (recommended)
- LuaJIT — included in
luajit/for Windows - SDL3 —
SDL3.dllincluded inluajit/for Windows; on Linux installlibSDL3
Love2D (alternative)
- Love2D 11.x or newer
Windows (LuaJIT):
run-app.cmdor directly:
luajit\luajit.exe app.luaLinux (LuaJIT via Wine):
bash wine-luajit-app.bashLinux/macOS (native LuaJIT):
luajit app.luaLove2D (any platform):
love .| File | Description |
|---|---|
app.lua |
LuaJIT + SDL3 entry point (window, event loop, FFI) |
main.lua |
Love2D entry point |
common.lua |
Shared rendering: rasterizer, lighting, texture sampling |
algebra.lua |
Vector and matrix math (dot, cross, normalize, perspective projection) |
loader.lua |
OBJ and STL model loaders |
ffi_defs.h |
SDL3 C type definitions for LuaJIT FFI |
assets/ |
3D models (OBJ, STL) and textures (BMP) |
luajit/ |
Bundled LuaJIT + SDL3.dll for Windows |
| File | Description |
|---|---|
assets/head.obj |
Human head mesh |
assets/ToughGuy2.obj |
Character model |
assets/teapot.obj |
Classic Utah teapot |
assets/stl-ascii-teapot-axes.stl |
Teapot in STL format |
assets/floor_plane.obj |
Floor plane with UV |
assets/axes.obj |
XYZ axis display helper |
assets/checker.bmp |
Checkerboard test texture |
| Input | Action |
|---|---|
ESC / close window |
Quit |
| — | Scene rotates automatically at 45°/s |

