Houdini: Clean your point cloud
Updated: Apr 12, 2020
Let's say you've imported a super messy point cloud that you want to clean up.
Pictured below is what's commonly referred to as a Sweetgum Tree Ball.
Generated in RealityCapture, exported as an .xyzrgb, and loaded into Houdini using a Table Import SOP.
We want to remove sparse points.
We run a connect adjacent pieces into a clean SOP. This will remove points that have no nearby neighbours.
We then use an add SOP (tick the 'Delete geometry but keep the points') to turn it back to points.
There are still some clumped stray points we do not want.
The next part is a neat little trick that Nathan Barrett (https://houdinisketchbook.tumblr.com/) taught me. We convert our point cloud into blobby meshes via converting to VDBs.
Now they are clumped, we can use the gamedev delete small parts to filter out those unwanted clumps.
We can then group the original points by a Bounding Object - that being the blobby mesh. The delete node simply removes the points that aren't in the keep group.
We're also using the blobby mesh to compute the normals, and transferring them onto the point cloud via an attribute transfer. I'm using a simple python script to export all the points, their normals and colours to a .ply format which can be opened in various other applications.
Presto! There are a few stray points near the mesh that can be filtered out by reducing the VDB blobbiness, but overall it's much cleaner.