Recommended PointCloud workflow with Blender?

Hey all,

Im struggling to find information on how to best use Blender-edited point clouds in three.js for this seemingly simple but exiting design-case:

  • Get point clouds from various sources, edit them in Blender. (remove, recolor, rescale individual points - this works)

  • Export point clouds containing individual point colors, and individual point sizes.
    (gltf export doesnt seem to retain the point size, and often does not export a cloud at all…)

  • Load point cloud in three.

  • ideally also: Interact with loaded point-cloud in three.js code , f.e. to set point size realtive to camera position.

I would prefere use gltf, but i cant find any resources explainig this use case even with ply or other formats.

Is this even a feasible approach or are there fundamental limits making this hard to do?

Anyone tried this?

Any direction to go about this woud be a massive help.

Blender’s glTF Exporter has an option, Data → Mesh → Loose Points, that must be enabled to export points or lines. This should include point colors, if they are vertex colors or UV-mapped textures. Unfortunately — don’t know of any way to export sizes of points, except to use small instanced spheres with a fixed size in world space. You may want to control size in pixel space with three.js instead.

If you do decide to export instanced spheres instead, keep the poly count of each sphere as low as possible, and use something like this to optimize the file so it uses THREE.InstancedMesh:

npm install --global @gltf-transform/cli

gltf-transform optimize input.glb output.glb
2 Likes

Thanks a lot, thats seems harder than i thought it was :slight_smile:
Might it be easier with pcd-loader, even if there is no draco?

I think it will be similar with PCDLoader – points and colors, but no custom sizes. I’m not aware of any supported format that supports custom point sizes. Even in three.js you’ll need a custom shader to set individual point sizes:

https://threejs.org/examples/?q=points#webgl_custom_attributes_points

Blender does have custom vertex attributes though. If you can figure out a way to export your point sizes in such an attribute (I don’t know how to bake the sizes to a vertex attribute in Blender, but I do know it can export custom vertex attributes to glTF…) then you’d be able to use the vertex attribute in a WebGL shader in three.js.

1 Like

For reference, some time ago Waldemar Lehner posted in this forum a solution for setting points size using a custom shader: demo, github repo, and discourse thread with notes.

2 Likes