Page MenuHome

Colored point cloud support in Blender 2.81+.
Needs RevisionPublic

Authored by Jace Priester (jacepriester) on Mon, Jan 13, 2:55 PM.

Details

Summary
  • Add support for colored point clouds (per-vertex colors) to the Overlay engine.
    • If a mesh object has an integer CustomDataLayer (4-byte RGBA) with the name "per_vertex_color" it will use that data as per vertex colors.
    • This commit covers all changes to the source to get them working for 2.81+.
    • Point cloud objects continue to exist as regular Mesh objects (only having verts and no edges/faces). Therefore all existing mesh tools are functional.
    • There is a new Python function for CDLs: from_pydata, which allows setting the whole CDL with one call. This is infinitely more efficient than setting CDL data one vertex at a time from Python.
    • It is expected that the color data will be set by importers that import point cloud data (xyz/pts format and many others).
    • An XYZ/XYB/PTS importer currently exists which supports loading the color data into the CDL in this way. It is not part of this commit as it is a Python extension.

Diff Detail

Event Timeline

Hey @Dalai Felinto (dfelinto) or @Brecht Van Lommel (brecht) I'm not sure how this goes into the curfew, but it's a very interesting feature for many many people, who may review this?

@Juan Gea (juang3d) new patches are part of the daily development routine of the module teams.

@Jace Priester (jacepriester) could you provide a test file and some use cases for this feature?

@Dalai Felinto (dfelinto)

The use case is that anyone who works with point clouds needs it. Every other major 3d program has support for this. Engineering firms typically buy something like Autodesk Recap or SCENE just to view point clouds from their laser scanners. FARO/Leica/etc laser scanners produce point clouds... not meshes... and meshing them is not feasible and/or not the correct approach to working with the data. Blender supports the location data of point clouds just fine as standard mesh objects.. it just renders them as loose points... but does not have support for per-vertex color. This patch uses a custom data layer to support the color channel, and upon mesh cache generation it adds the CDL color information to OpenGL buffers which the updated vertex and fragment shaders use. For any meshes without the specially named CDL there is effectively no change (and no change in memory footprint).

Attached is a sample file. You can open it with a release version of Blender to see it still opens fine.. and in fact preserves the color data through loads and saves since it's a standard CDL, it just doesn't render it... and then open with this version of Blender (built here: https://blender.community/c/graphicall/Fjbbbc/) to see it colored properly.

FYI I have not added colored point cloud rendering into the actual render engines.. just the Overlays engine... but point clouds aren't a pretty end result anyway and I would not consider it a priority. They're reference data for further modeling, typically. In any case a Viewport Render is possible as-is.

Also attached is a screenshot of a laser scan of a parking garage, shown with a couple cubes lighted in EEVEE mixed in.

Brecht Van Lommel (brecht) requested changes to this revision.Mon, Jan 27, 5:26 PM

The functionality is useful, but the design and implementation of this is too hacky. Using an integer layer named per_vertex_color encoding a color is not something we would accept as built-in functionality.

There are a few projects under development which will provide a better base for this:

Further, I don't think this belongs in the overlay engine, drawing needs to be properly supported as part of render engines.

I recommend to leave this patch on hold until we are further along with the other projects which will provide a better basis for this.

This revision now requires changes to proceed.Mon, Jan 27, 5:26 PM