A purely software (no OpenGL or DirectX) realtime 3D renderer, that I’m trying to build to learn some math and magic behind 3D graphics. It uses raylib for window management and delivering pixels to the screen, but all the rendering is done from scratch in Go with no external libraries.
Running in multi-core mode at 1280×720 resolution on my laptop, it maintains 95-105 FPS for an untextured object made of 200K triangles. Not counting the culled ones, this results in pushing around 10 million triangles per second to the screen.
demo.mp4
Sonic-HD 3D model by alexandelyt (Sketchfab)
For this, you may need a C compiler and additional dependencies required by raylib. See https://github.com/gen2brain/raylib-go#requirements for details.
$ make build
$ ./goxgl models/suzanne.obj
Camera uses WASD + mouse to move around (like in most first-person games). ESC key closes the window. There is also a bunch of keys to toggle different rendering options like wireframe, texturing, backface culling, etc.
- Wireframe rendering
- Backface culling
- Affine texture mapping
- Perspective correct texture mapping
- Flat shading
- Gouraud shading
- Z-buffering
- View frustum clipping
- OBJ file support (with MTL files) - only triangulated
- Parallel tile-based rendering
- Multi-object scenes
- Scratchapixel
- tinyrenderer by Dmitry V. Sokolov
- Math for Game Developers series by Jorge Rodriguez
- Code-It-Yourself! - 3D Graphics Engine series by javidx9: part 1, part 2, part 3, part 4
- 60005/70090 Computer Graphics lectures by Bernhard Kainz at Imperial College London
- Optimizing Software Occlusion Culling series by Fabian Giesen
- Alias/WaveFront Object (.obj) File Format
- Go assembly language complementary reference by Iskander Sharipov
- Doom E1M1: Hangar - Map (.obj) by pancakesbassoondonut
- 16x16 pixel textures by PiiiXL