Point File Out : Exporting geometry

What is the best way to export point clouds? I am currently recording point cloud sequences from Azure Kinect using the repacked movie file method and then reimporting them with moviefilein by unpacking them again. But what if I wanted to export sequences of ply or pts or obj files for use in other environments. I can imagine going frame by frame and accessing my unpacked pointcloud moviefiles with a topto chop and then a chopto dat, reading each pixel’s rgb values into a text file, but that seems clunky. What is the best way currently?

Best way would be an .exr sequence, 32 bits and multilayer (position, color, normal and more). Quite heavy but with a good SSD, it works

1 Like

ply and xyz files have an ascii format - the trick here would be to save your frames to a buffer, then write those out into a ply file.

Here’s an example:
save-ply-sequence.toe (6.0 KB)

This assumes that you have multiple buffers to capture position, normal, color, etc. This approach works well in terms of capturing content that you’re going to playback or review in Touch and meshLab. If you want something that opens in a game engine, or another 3D editing package then you should modify the script to change color channels to be unsigned characters uchar as 0-255 vals with full names red green blue. You can see more about the PLY spec here:



Thanks Jacques. I had tried that obj method before moving to the repacked movie method, as the performance was much better. But I guess I could go back to that for this purpose.

Thanks Mathew. Very helpful toe with the xml formatting example.

1 Like

Hey, thanks for the project example. I’m having trouble changing the script to use unsigned characters. The one you’ve provided doesn’t seem to save colour data in a way that Blender can read.

Welcome to the forum @maxbrading

A couple things to keep in mind. If you’re using blender, you’ll want to checkout this alternative importer for PLY files:

In the example TOE file you’ll need to make a few adjustments. For the header, make sure to change the r, g, b properties to be uchar instead of float and also make sure to change their names to red green blue as that’s what is going to be more typically recognized as color.

plyHeader = '''ply
format ascii 1.0
element vertex {size}
property float x
property float y
property float z
property float nx
property float ny
property float nz
property uchar red
property uchar green
property uchar blue
property float active

Next you’ll need to swap the color processing to be 255 based. You can do that by changing the setColor() method in the extension:

def setColor():
	colorNpArray = colorTOP.numpyArray()

	index = 0
	pointList = settingsOp.fetch('pointList')

	for eachRow in colorNpArray:
		for eachPixel in eachRow:
			point = pointList[index]
			point.r = int(eachPixel[0] * 255)
			point.g = int(eachPixel[1] * 255)
			point.b = int(eachPixel[2] * 255)
			index += 1

	settingsOp.store('pointList', pointList)

One other bit to know here is that I think this approach currently only works in Cycles at least for the point per vertext. If you’re instancing you should be okay to use Eevee

That did it! thank you :slight_smile:

1 Like