Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

arkenidar/graphic

Open more actions menu

Repository files navigation

graphic

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.

Screenshots

Smooth-shading 3D mesh from OBJ

Flat-shading 3D mesh from STL

Features

  • 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

Requirements

LuaJIT + SDL3 (recommended)

  • LuaJIT — included in luajit/ for Windows
  • SDL3SDL3.dll included in luajit/ for Windows; on Linux install libSDL3

Love2D (alternative)

Running

Windows (LuaJIT):

run-app.cmd

or directly:

luajit\luajit.exe app.lua

Linux (LuaJIT via Wine):

bash wine-luajit-app.bash

Linux/macOS (native LuaJIT):

luajit app.lua

Love2D (any platform):

love .

Project Structure

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

Assets

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

Controls

Input Action
ESC / close window Quit
Scene rotates automatically at 45°/s

Links

About

#claude_ai Love2D app with CPU-based 3D and common code *shared* with a custom LuaJIT FFI + libSDL2 backend , alternative backend that mimics Love2D but it's indipendent .

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.