Looking some info for anyone who has managed to export point clouds from the kinect into a format that would be useable in something like Cinema 4D/Maya/3DS max. Been looking at the issue for a few weeks off and on. ofMesh’s export option is a nice option for making ply’s with the points…but that’s meant to export tesselated meshes.
Since most programs don’t deal well with huge point sets (since they don’t have meshes or faces), using a particle rendering program seems like a logical step. I’ve mostly been looking at Krakatoa and Realflow.
Krakatoa has a really easy to recreate particle file format. I was able to modify something to spit out the vertex format, but haven’t actually gotten stuff to appear in 3DS max.
My next choice is Realflow, but I’m having a harder time understanding their file format. The PDF of the format is attached, but they are saved as .bin files so I can’t actually understand the structure of what I’m supposed to put in there. mostly the loop…if I could see what the raw text was I would understand a bit more…but as it is, that document is pretty opaque to me and I can’t find examples of exports.
Obviously the RGBD toolkit would be a good logical step in terms of recording the data (and I talked to james about this a while back, but then got pulled away), but I might be missing an area that might have a chance of outputting an .obj sequence from that toolkit
Feel free to just point me to other things I should research more.
Try creating tiny cubes or spheres centered at each of the points in the point cloud. If you can export multiple meshes in a single file then you should be able to load this file into max/whatever and it will render as a whole lot of tiny cubes instead of the abstract points.
I’ve been trying to find a solution for this exact problem as well. I started with RGBD toolkit and it does produce a good triangle mesh. @damian, your solution is a good workaround, but to use the mesh to full effect in a 3D program, it needs to be a true mesh with normals and faces. For example, if you were to throw liquid or fire at it in C4D, it would need to react to a complete surface with related points.
I emailed James George (creator of RGBD Toolkit) and got a great response (pasted below). I am also trying out “cinekinect” in OF, although it also seems to lack an export option. I’ve sent the creator an email and hope to hear from him soon. (link: https://github.com/outsidecontext/cinekinect)
Email from James:
"Theres no real easy answer yet, but this has been a big feature that’s actually next on the chopping block now that I have the tutorial videos roughly out.
If you want to dive in ahead of me, be my guest. The place to start is here:
This builds a series of meshes out of depth maps that exist on the CPU (the rgbdvisualizer app only builds the meshes using shaders, so CPU access and write to disk is tougher)
The goal with this example is to turn it into an OBJ exporter. in openFrameworks you can call ofMesh::save() and it writes a ply file that something like meshlab can convert to OBJ. there is also an ofxOBJ class to look into.
I plan on attacking this hopefully within the next little while – but as I said, go for it if you want to give it a try and let me know how it goes!"
yesterday I pushed to my github an obj exporter. I exports the texture also.
I did it to export images from the kinect so using it with RGBtoolkit should be very straightforward. In fact there’s no problem in having the higher res rgb images as textures because the texturemapping uses normalized coordinates to map (0 to 1).
I’ll see if I can make it work with RGBDToolkit during weekend.
Excellent! I’ll give this a try tonight when I get home. If I understand you correctly, I don’t need RGBDToolkit to do what I want. It sounds like your code takes Kinect image and depth data and creates an OBJ every frame, correct?
yes, that’s what it does. in the example it saves on every frame but actually is very slow. each frame will weight like 50MB, so exporting a sequence will weight a ton and take some time. It is better to record anything you want from the kinect and then run the exporter.
If you want to adapt the DepthToObjExporter class to save anything else, like a mesh, it should not be that hard. At least the code for formatting and saving data into OBJ should be the same.
@roymacdonald: Thanks for writing this export function: I am able to export obj sequences now. But there is always “however”: however, I can only open them in meshlab so far (for example: http://www.flickr.com/photos/79268016@N05/7911387612/). Cinema 4d or Blender do not produce an error, but do not show a thing on importing these obj files. What are you using them with? Any advice on what could be twikked to make Cinema or Blender see them? Thanks.
A bit of a different process (uses Processing/Python tags) but I played with this a bit last week and although a bit slow it worked getting Point Clouds into C4D and rendering.
I played with it too: wrote an export function in Cinder but cannot get their Cinema4d Xref load the animation: it just sits there looking at the first frame.
[quote=“eight, post:9, topic:10027”]
wrote an export function in Cinder but cannot get their Cinema4d Xref load the animation: it just sits there looking at the first frame.
[/quote] hmm - I was using c4d 12 and their example file if that helps. Haven’t tried it with 13 yet.
I wrote this to be able to render/modify the kinect capture in Cinema 4D.
I’m using a plugin for C4D called Riptide that allows to import textured .obj files.
Check the attached screenshots with the settings that I used to get a correct import.
!(http://forum.openframeworks.cc/uploads/default/2563/Screen shot 2012-09-03 at 1.49.34 AM.png)
Very interesting conversation!
I am looking for using animated point cloud or animated meshes in Maya.
I have found this script that looks useful http://www.creativecrash.com/maya/downloads/scripts-plugins/dynamics/c/cache-cloud that turn point cloud into maya particles.
It use .csv file. Do you know how to record point cloud with kinect (windows) in .csv?
@roymacdonald: Thanks! I am now seeing the textures! On to animating sequences.
That csv file format is very simple: “x, y, z, number”. It should be very easy to adapt roymacdonald’s code to create this format, basically you would need to leave one loop there and change the order of the data in a row.
@hugoa, “csv” stands for Coma Separated Values. As Eight says is very simple and straight forward.
Yet be aware that this wont include texture data, probably it won’t even carry color information. It really depends on how the csv file is “formated” and which kind of data it is supposed to store.
If you tweak a little bit my code you’ll get a csv file very easily. The .obj file contains all the vertex data int the form “v x y z”, where the v is to indicate that is a vertex and x,y,z are the number coordinates of the vertex. Just remove the v and add a comma after each coordinate. Comment out all the rest of the code that writes the normals and texture mapping stuff.
Let me know how it goes.
Thank you 8 and roymacdonald for your answer.
In fact I am a 3D artist but not a coder and I am totally new to openframeworks. For the moment I dont even know how to launch a script! I have to spend some time to see how it works.
@hugoa you’re welcome.
don’t worry, many people here have an art background, including me and got into coding from working in “digital art”.
Maybe I an give you a hand with the csv point cloud export later today.
I’ll post my results.
I have manage to do want I wanted (to have a 3D sequence in Maya) using Brekel (you probably know that software that is great).
I can capture either in PDC (maya particles) or Obj files. For the moment I dont have a good fps rate but I am working to improve that.
Alexander just posted a demo video on how to get sequences out of RGBDToolkit and into Maya https://vimeo.com/56143282
It uses the new OBJ exporter built into the new version of the toolkit (http://www.rgbdtoolkit.com)
Hope this helps some people out!
just for anyone that might need it.
when you import an obj sequence into c4d you’ll see all the frames one over the other but not as a sequence that you can play.
so to fix this you must use the attached C4D project. The xpresso script within it will handle this issue and you’ll be able to see the sequence as a sequence.