What does HackerNews think of VoxelSpace?
Terrain rendering algorithm in less than 20 lines of code
I did a bit of reverse engineering myself on some 3D game worlds. Test Drive 3 [1] and Comanche [2]
I've been inspired by Michael Fogelman's Craft [1] and other links around here over the years to learn more about 3d graphics programming. comanche has been my path to learning. It can currently render 30 different maps - 29 of them were reverse engineered by Sebastian Macke [2] from the game Comanche (1992). There's no actual relation to the game, I just remember playing it as a kid and the file format is convenient (two pngs, one representing height, the other color). There is a lone map by me.
The goal is to build an actual game, but the focus will always be to have very readable source so that others can learn from it. I've written a blog post further describing the goals behind it as well as discussing the basics of graphics programming and the advantage of using WebGL [3]. There are plenty of links to resources for further learning and the post also includes links to 8 other projects in various languages (lisp, Go, Rust, C++, and Nim) in various states of completion.
Happy to accept questions, contributions, or (gulp) critiques. There's not a lot of optimization going on (some basic culling), but it should run fine on a modern GPU (though it did not run on my mobile phone). Some of the maps are smaller, should that help. It's not super impressive, but hopefully you find it interesting. Thanks!
1. https://github.com/fogleman/Craft
2. https://github.com/s-macke/VoxelSpace
https://github.com/s-macke/VoxelSpace
The text in the README describes the technique very well. The JavaScript code is a little bit more complicated to read because most of the source contains the usual organizational tasks around the algorithm (initialization, keyboard input, ...). But this is also true for the provided C-code of this article.