Importing Kinect's point clouds in Houdini
Hi guys!
Just to let you know, this year we’re facing an extremely hot summer here in Italy (50 degrees in some cities!), so as you would image sitting all day in front of a screen is getting quite challenging.. nonetheless, I’m still too excited about learning Houdini to stop my researches! This time I picked up an old time classic from the interactive world, the Kinect , and I wanted to push it a little forward. I wanted to import point cloud animations into Houdini, and manipulate them in all the magical ways that this software lets us do.
Exporting .ply from Openframeworks
As a first step, you need to create the point cloud animation by recording the kinect data.
I’m using OpenFrameworks in order to connect with the Kinect and export a binary .ply
file for each frame received.
On my github repo you’ll find the code, which is very easy and mostly grabbed online and from the examples of the official library. A .ply file contains a header and a list of x,y,z position for each point. The header structure can be seen from https://en.wikipedia.org/wiki/PLY_(file_format) and the list of points in our case was supplied as stream of bytes (see https://stackoverflow.com/questions/20400128/how-to-write-a-file-byte-by-byte-using-c)).
And that’s exactly what we’re doing here, using the ply binary format:
Full source code is here : https://github.com/VVZen/open-visuals/blob/master/openframeworks/myApps/kinect_export_test/
Then, import the .ply into houdini
Simply use the file sop and load as an animated sequence (use the houdini $F var in the file name) .
Obviously, the scan is quite rough, but this makes a huge part of the final aesthetic, which is quite glitchy. If you start to play with Houdini, you can easily add a delaunay triangulation to the points.
Or, in alternative, another approach is to convert to a vdb using the vdb from particles
node and the remesh using the convert vdb
node.
Here’s an attempt to create a voronoi look like the one in the majestic Chemical Brothers video :
And some gifs with different experimentations:
My houdini scene is quite a mess and I should really clean it up, but if want to take a look please send me and email or drop a comment below! I hope you found this post useful!
Namasté