Blazingly fast voxel data generation
Dev logs
17:50
My voxel engine (Rust+Bevy), is now 25 TIMES FASTER.
I mainly used 4 techniques, 1 of which I've never heard anyone do.
1. Extremity bound checking (automated)
2. Noise up-sampling
3. Noise Cashing
4. RLE based runtime voxel data
baseline: 20 million voxels / sec.
optimizations: 500 million voxels / sec.
I can fly 320 blocks per second, and the engine keeps up.
RLE allows for 32x256x32 chunk sizes, which has some surprising benefits.
Low RAM, instant (file/network) no compression needed, faster chunk management/scanner, fast y range memory writes, fast surface detection, data fits in L1 cpu cache.
the cons: slower random memory access+modification.
^this con has not affected me yet, because I do not have surface feature implemented yet.
Q: What about ambient occlusion + RLE?
To binary greedy mesh, we always transform chunk data into bit-arrays.
So when sampling for AO, I don't random memory access the RLE.
it's fairly cache-friendly to unpack the RLE into the bit-arrays.
Fun fact: I sample AO in a 5x5 range, and it's still this fast :o
Data gen also traverse in such a way that we NEVER have to randomly memory access the RLE. That's how I can use RLE, and still be very fast!
Q: How does the binary greedy mesher work now?
Considering my greedy mesher works upon u32 bit-arrays, i can't fit 256Y inside the bit-array data. Hence, I segment up the world into 8 seperate (32*32*32) volumes.
If my chunk data contains faces spanning y:0 to y:64, My mesher will only generate 2 seperate meshes.
#bevy #rustlang #voxel




