- Home /
Sparse octree in Sqlite?
I'll try to keep this as short as I can. My concept: voxel terrain, minecraft-like rendering of cubes:
A composite pattern creating a 32-level sparse octree with the lowest level being 25cm in size.(*)
Every composite of that hierarchy stores its children(/parent) and a 8-byte variable for material type. Parent composites will get a material based on the materials in its children, so you don't need to go down to the smallest cubes for information when the camera is far away.
The question is, can sqlite handle such potentially large amounts of hierarchical data?
If possible, what's the best sqlite/sql-patterns to follow for such a octree?(**)
And if not, do you have any tips on how you would have done it?
This might be more of a Stack Overflow question, but the use is very obvious so I figured I'd ask here first :)
-
*(Unoptimized/non-sparsed this thing would be horrible, 65billion exabytes on the top level, and that's just with 8 bytes per lvl 0 node and not counting the necessary data per level)
-
**(not an sql expert, been looking at hierarchyId and r*-tree systems, but the former doesn't seem to be a part of sqlite and the latter seems less optimal for a octree hierarchy. Though it never hurts to ask.
-
Also, other more conventional sql patterns like "nested sets" looks terrible for this sort of system, though I might have missed something.)
Sounds like you want some kind of NOSQL sparse hash table to me.
Something like this? Depends if you just need the key lookup. I've got one I wrote for Silverlight somewhere, but I haven't tested it for Unity yet.
Certainly seems closer to home than sqlite, was planning to look into mongoDB, but this looks like its more up for the specific job. Thanks for the tips so far :)
Hey you can check out this page, I guess you are after the tuple storage stuff a few pages down. I'd be very interested to hear how you get on with this project.
I'll give some heads-up if it works out well, going to take some time though, but I think it might have potential