Port Current Octree To Morton Code

Maybe it would nice to port the current recursive implementation of the Octree to a Morton Code based one, that is more performant with max O(n) = log(n).
Moreover, in order the Octree becomes more generic and usable by other “objects” than meshes, maybe it would be better that it doesn’t rely on meshes but only on vectors3 (min, max… in other words, what describes a BBox).
It could then be used for other entities : particles, solid particles, points of clouds or logical ones in the user code.

Very good tuto about how to implement the Morton code in C++ in french here : Octree optimisés gràce au code de Morton
An automatic translator should do the job as the article is really well written.

Another light implementation here for 3JS in JS : Octree · GitHub

I don’t want to break the existing Octree so I won’t code it, unfortunately

Well the octrees are internal and mostly used by internal objects so I would not care too much about backward compat if we have a big perf gain

1 Like