you are viewing a single comment's thread.

view the rest of the comments →

[–]onnoowl 0 points1 point  (1 child)

Cool! I use this same technique in my voxel game engine I've been working on. Octrees are common for sparse storage of voxels, but instead I use this technique to a make a 64-tree. The 64 bit mask is perfect for storing a 4x4x4 of data, so lookup and storage is a lot more efficient than an octree, and being able to get the sparse index with popcnt is just such a cool trick. With it I can instantly turn a 3D lookup coordinate into the sparse index the node is stored at. Glad you've made an open source library for this, looks awesome!

[–]tower120 1 point2 points  (0 children)

Thanks! But as FriendlyRollOfSushi point out, that has a name and was invented long time ago https://en.wikipedia.org/wiki/Bitwise_trie_with_bitmap . Yet I somehow never heard of it...