/3d-soft-engine-lua

🧪 A simple 3D engine written in Lua using using lua-fenster.

Primary LanguageLuaMIT LicenseMIT

3d-soft-engine-lua

A simple 3D engine written in Lua using using lua-fenster.

Some time ago I wanted to learn more about 3D engines, so I read this tutorial series by David Rousset and then translated the TypeScript code from the tutorial series into Lua: Tutorial series: learning how to write a 3D soft engine from scratch in C#, TypeScript or JavaScript

This 3D engine is obviously not production-ready or really anything to be taken seriously, but I had a lot of fun writing it!
It runs completely on the CPU and doesn't utilize any sort of hardware acceleration or graphics library like OpenGL, therefore the term "soft engine".

This is actually a rework of a very old project of mine, which used LÖVE2D instead of lua-fenster (my own GUI library).
If you want to see the old version, check out the old-love2d-version tag.
The code is a bit messy though.

Screenshots

Screenshot - Monkey Screenshot - Teapot Screenshot - Torus

Requirements

  • LuaJIT 2.1 or Lua 5.1 (newer Lua versions might work but not tested)
  • LuaRocks

How to try

Download the repository and install the dependencies with luarocks:

$ luarocks install --only-deps 3d-soft-engine-dev-1.rockspec
# or manually
$ luarocks install fenster
$ luarocks install dkjson

Afterwards, run main.lua:

$ luajit ./main.lua
# or
$ lua5.1 ./main.lua

Feel free to play around with the main.lua file, trying out different models and such.