Point Cloud - Removing empty pixels from a texture

Hi there!

I’m playing with point clouds in touch lately, and I have a question: How can I remove the empty pixels from a point cloud texture? (see capture).

I’m using some GLSL (thanks @elburz for the idea) to crop my point cloud. The resulting texture has the same size as the pre-cropped texture, and all the removed points are now empty pixels (0,0,0,0). Because the original point cloud is pretty big, the original texture is about 3000x3000px. After the cropping, only 1/3 points remains, meaning that 2/3 of the texture are empty pixels. I’m looking for a way to remove these pixels so I could get a 1000x1000 texture with only a few empty pixels (cleaner and more optimized for rendering!)

I did some research but I didn’t fount the proper way to do it… Any idea?
Thanks in advance for your help!

Ok, so answering my own post here. After some experiments, here’s my current solution to remove empty pixels from point cloud textures. Of course there is room for improvement but this solution works nicely for a static dense point cloud. Here’s how the .tox works:

Inputs:

  • position texture
  • color texture

Parameters:

  • min and max value on each axis

Inside the .tox:

  • crop position and color textures with GLSL (based on @elburz idea)
  • remove empty pixels with ScriptTop (numpy)

The result is two much smaller textures that you can then use with the PointRender .tox from the palette for example. Removing those empty pixels reeaaaaally helps for performance, so it was worth it. On the screenshot, before removing empty pixels, the textures were 5 million pixels each, and after cleaning, there are down to 1.5 million pixels each. I can now play with it with some more glsl or some point transform TOP and render them as instances running at 60fps. :ok_hand:

Hope this will help!

PointCloudCrop_v3.tox (2.2 KB)

2 Likes