Show HN: VoxelChain – An Experimental Voxel Engine (voxelchain.app)
VoxelChain is an experimental tool to create voxel worlds in the browser. The lighting is fully ray traced in real-time and there is powerful cellular-automata based programming system, which allows to create complex digital circuits and model the behaviour of voxels (behaviour such as falling sand or water).
Technology wise, I'm using WebGL2 for the rendering and the simulation is coded in C89 and gets compiled to WebAssembly (with multi-threading) using Clang. The simulation is basically a custom cellular automaton and is fully parallelized. Once WebGPU is released, I'm planning to run the simulation on the GPU, instead of the CPU, which will give a massive speed up.
I've been working on this project full-time for over a year now, and finally came to the point of realising a public version of it to play with. There is already some really cool stuff that the community has built, and it's super fun to see how everything evolves!
Let me know what you think and feel free to ask any questions :>
40 comments
[ 3.1 ms ] story [ 83.1 ms ] threadThe author's got tons of video demos on their YouTube channel[0] as well.
[0] https://www.youtube.com/c/xima1
Otherwise nice work!
EDIT: Reduced the DOF intensity
Console error shows:
On the same Mac, I get "Your browser is not supported" for Safari 15.6.1, and Safari Technology Preview R152 (Safari 16.0) with "WebGL 2.0" and "WebGL Draft Extensions" enabled under "Experimental Features."
Using Ungoogled Chromium 105.0.5195.102 (I refuse to use Chrome), the site actually seems to leave the GPU in a messed-up state, going on to cause severe rendering problems in other applications. I'm not sure if this is a Chromium bug or a macOS bug or both.
on same laptop using chrome Version 106.0.5249.21 (Official Build) dev (64-bit) get error
[.WebGL-0x1b80018ed800]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: Source and destination textures of the draw are the same.
again this same chrome browser runs other WebGL just fine
That said, I wonder if newer tech like nanite has started to displace these techniques. When you get to a point where you can rasterize triangles that are smaller than a single pixel at interactive frame rates, one starts to wonder what unique advantages voxels still bring to the table.
- [0] https://www.youtube.com/watch?v=NRnj_lnpORU
- [0] https://github.com/VoxelChain/voxelchain-programming
[0] console: "WebGL warning: readPixels: Format and type RGBA_INTEGER/UNSIGNED_BYTE incompatible with this RGBA8UI attachment. This framebuffer requires either RGBA_INTEGER/UNSIGNED_INT or getParameter(IMPLEMENTATION_COLOR_READ_FORMAT/_TYPE) RGBA_INTEGER/UNSIGNED_INT."; Firefox 104.0.1; openSUSE Leap 15.4
Unfortunately it doesn't work on Firefox on Ubuntu 20.04 with an NVIDIA GTX 3090Ti. :(
For someone naive to making games with voxel's, are there any resources that you would recommend (rendering, mathematics, ...)? My thought was to look at resources similar to how Noita simulated their pixels (GDC talks) and attempt to scale that into 3D.
Would you mind explaining what approaches are available for debugging webgl running in webassembly?
Did you chose webassembly for a specific reason rather than just using javascript?
What webgl2 apis do you recommend using to keep FPS reasonably high? I've been using instancing for most of what I render as it is said to be highly efficient.
Just curious!
EDIT: Just looking at your youtube channel and your project is really impressive!
Edit: Changed link from Kickstarter page to project website.
Are any of the demos interactive, apart from moving the camera? Two of them seem to have buttons, but they don't respond to clicks.
Meh.
Can you please describe the cellular automata rules you're using, what your goals and techniques were, and what inspired you?
I took some inspiration from Noita and Sandspiel, but I found that falling sand simulations aren't flexible enough and I was thinking about how a system could be created to visually program the behaviour of circuits or stuff like falling sand yourself. Also Noita is single buffered, while my simulation is double buffered which actually makes a huge difference in the possible features you can realize. Single buffering is faster but much more chaotic and "random", while with double buffering you get very precise behaviour. Also the simulation was designed from the ground up to be run on the GPU, while Noita and Sandspiel are CPU-based. Here's [0] a video of a previous 2D prototype doing falling sand on the GPU
- [0] https://www.youtube.com/watch?v=aWLPEzngkOo