Are you sure about that?
It is not random. It is very organized. And it is not a space traversal technique. Read the article I linked, search for first mention of morton code and think about it.
To any 3d object you assign an unique code based on thier coordinates, called a morton code.
Sorting objects by that code organizes them in such fashion that is already partitioned in correct way to represent a collapsed aabb tree.
Here’s 2d aabb tree based on z curve.
┌──┬──┬──┬──┐
│ 0│ 1│ 4│ 5│
├──┼──┼──┼──┤
│ 2│ 3│ 6│ 7│
├──┼──┼──┼──┤
│ 8│ 9│12│13│
├──┼──┼──┼──┤
│10│11│14│15│
└──┴──┴──┴──┘
You want the whole cell? The indexes are in [0…15] range.
Upper left corner? Indexes are in [0…3] range.
Bottom left? [8…11] range.
Data is sorted. You can find upper_bound/lower_bound indexes and individiual indexes using binary search.
Storage is trivial - it is an array. If you know boundaries of data of bigger cell, you can find data in a lower resolution at less time.
Also, coordinates of the cell are already encoded into the index.
That’s absolutely not what the z-curve is about. GPU hardware is also perfectly capable of processing random data without “pixels” being involved.
If there are people who frown upon octrees while dealing with voxels, I think they should consider changing their profession.
No, you don’t.
The data is not random. Techiniques like octrees allow you to skip huge blocks of voxels entirely without processing individual cells. That’s the whole point.
Yes.
You missed benefits of octrees while processing sparse data, and you missed the point of using morton codes which are based off z-filling curve.
The point of z-filling curve is that based of objects coordinates you generate unique index (which encodes coordiantes), and when object are sorted by this index, they end up in a compact representation of AABB trees. The reason why it is used on gpus is because GPUs can perform parallel sort. Meaning in systems like NVXGI you can grab the scene, generate morton cells of it, sort them, and then feed them into something else without ever touching CPU side of things.
I’d suggest to google for “morton code GPU”. For example:
https://devblogs.nvidia.com/parallelforall/thinking-parallel-part-iii-tree-construction-gpu/
Octrees and bounding volume hieararchies will be very important when dealing with voxels, because otherwise you’ll be much more limited by your computer memory. Basically, volume hierarchies allow sparce representation of data, where data that does not existed is not stored. A basic “dumb” 3d array representation will severely limit you, and it takes much more time to traverse it.
Volume Hierarchies or z-curve based representation allows you to immedaitealy realize that the whole underlying block is empty or that the whole underlying block is filled with a single value, meaning you will not need to waste your time walking through it probing every cell for data.
So, basically, in case of 256x256x256 cube algorithmic complexity in best case scneario will drop from 16 million operations to one check, and similarly amount of used memory will drop from 16 megabytes to just a few bytes. And now you tell me there’s someone in the world who look down at octrees with dealing with this kind of data.