You might not be aware of the fact that you most likely have been using the algorithm we’re discussing here – at least if you’ve ever worked in 3D. Quadtrees (and their relatives, KD-Trees and Octrees) are used to accelerate point queries (ever used pcfind() or nearpoints() in Houdini?), make rendering faster (ever waited for “building raycast accelerator” to finish?) or to compress images. Also they are mesmerizing to look at.
Preface: I’m aware that this isn’t the fastest or most sophisticated solution – head over to our Patreon for a setup that is a tiny bit quicker 🙂
Space partitioing algorithms are interesting for two reasons:
1. They are ubiquitous in computer graphics (see above)
2. They can look amazingly complex yet regular.
I’ve been looking for a setup that can easily visualize those algorithms but so far haven’t found anything ready to use. Perfect excuse to hop into Houdini and build a Quadtree yourself!
Great work again, thank you.
Like your tutorials. Wanted to see if i could optimize your code on this one (since i now have some free time 🙂 ).
Your file generated 17k faces in 1 min on my machine.
My file generates 17k in less than a second.
In less than 1 min i could generate 8.5 million faces.
I have not checked out your patreon file so i cant compare it to that.
Link to file: https://www.dropbox.com/s/8m09nb4bhbrcuji/quadtree_01.hiplc?dl=0
I aprreciate your solution, Thomas. Instead of using Subdiv node, you subdivides the prim by VEX code, and VEX is a lot faster. It’s really an eye opening for me. From now on, if i can use VEX to substitute any node, i’ll do it.
By the way, i did try using Compile block to improve the speed. It’s possible with the “font” node, but not possible with the “attribute from map” node (currently it’s still uncompilable). Hope for more compilable nodes in future.
Great tutorial, as ever! You got me really inspired (still from an upcoming short):