Pure CPU software renderer written in Rust, following Dmitry V. Sokolov's tinyrenderer course.
Yes! I mean probably. It works on my 2021 M1 MacBook Pro. I might have hardcoded things that won't work on other systems.
You'll need the rust toolchain and just installed. Then:
git clone https://github.com/kshitijl/tinyrenderer-rs.git
cd tinyrenderer-rs
just launch
After installing rust, do cargo install just.
- Parallelize using
rayonor maybecrossbeam. Figure out how to avoid a lot of contention writing to the depth buffer (and, by extension, at that location in the color buffer). Or maybe just parallelize over all the pixels within one triangle -- those will never contend for the color nor depth buffer because they're different pixels (thanks to Joe Ardent for this insight!). - Rewrite the game logic using
hecs. Or roll my own mini ECS. - Keep score and health, then draw them to screen by implementing some kind of font rendering. Maybe Hershey fonts (thanks Dave Long for that reference!).
- When the player dies, show a "YOU DIED" message and restart with a new randomly generated world.
- When the player wins by uncovering all exhibits, show a short victory sequence.
- Guards should not pass through walls. They should pathfind instead.
- Play sound effects when: guards enter Alarmed mode, an exhibit is uncovered, damage is taken, we enter FPS mode.
- Menu for selecting difficulty level.
- Fix the AWFUL clipping in FPS mode when we get too close to walls. This probably involves clipping triangles properly against the view frustum to generate new vertices.
- Draw a real player character instead of just a white bouncing model.
- Keep the camera behind the player in topdown mode so we can always see them.
- Keep the player model from clipping into walls.
- Fix the object frustum culling: right now, an object is culled if all of its AABB corners fall outside the frustum. But this incorrectly culls objects that have portions visible inside the frustum, like large walls. Instead, we must check for view frustum instersection.
Here's a teaser of the end state:
Video here. Sorry it's a Youtube short! I guess they automatically do that if your video meets certain criteria. Sad.
Here is the journey of this renderer so far:
Once I had a renderer I figured I might as well make a game with it.






















































