New PLY Importer v2.0

import-ply-as-verts v2.0                 Logo_Blender-Dark

Blender 3.0 * / 3.1 Alpha (and later) New PLY Importer

  • * Vertex colored mesh only in 3.0 (see Compatibility).
  • Complete drop-in replacement for the stock Blender PLY import module.
  • Correctly loads vertex-colored point clouds and nonstandard PLY files that the original importer wasn't intended for.
  • Retains the functionality of the original codebase.

Free at our Github Repository

Why

  • Attempting to import any of the below PLY files with the stock importer will fail:

    • Triangle/Quad Meshes with nonstandard file terminators (BTracer2 PLY export)

    • Zero edge/face point cloud files, ie:

      • Mandelbulb3D BTracer Point Cloud (v.1.99 and earlier)

      • Mandelbulb3D BTracer2 PLY (1.99.12 and later)

      • J-Wildfire Point Cloud (Some incompatible edge cases may yet exist. They will be patched as needed.

      • Photogrammetry scans (MeshLab, et. al.)

The result in Blender is the system console window error message “Invalid header, etc…”

Error-Message

Which has proven most frustrating for several years now.

Prior to this, a good workaround was to process the point cloud in MeshLab. I love MeshLab and use it often, but it is daunting at best. The real idea was to have native Blender import.

Recent functions added under the hood of the Realize Instances node suddenly dovetailed with a standalone instancing app I had been working on since 2017. Realizing that six nodes can replace my entire program, I cheerfully abandoned it and put full effort into the importer.

The combined result is a completely new workflow for the point cloud enthusiast.

Result

(Left to Right, Back Row First)

  • Vertex-Painted Suzanne (Same file as Mesh and Verts);
  • BTracer2 (Same file as Mesh and Verts);
  • J-Wildfire Point Cloud;
  • Photogrammetry Point Cloud

All the objects in this scene share a single Material of correctly imported vertex colors. The point clouds have a simple Geometry Node tree applied . (Material and Nodetree included in the Example.blend file).

Compatibility

  • Mesh Import is verified for 3.0 (thanks to Carisma Alex for asking!) and works exactly like the process in Mandelbulb3D - BTracer2 Workflow Basic. However, the Point Cloud object requires new functionality added in Blender 3.1 to correctly assign the colors. Direct import results in a charcoal briquette with missing surface normals. A workaround is to create the Point Cloud in 3.1 (with applied Geo Node Modifier), save as a .blend file or export to a modern format like .gltf, and open in 3.0. “Shade Smooth” appears to work incorrectly when doing so.

Install

Since these are Scripts and not an Addon, the __init__.py and import_ply.py files from the repo will need to be manually pasted alongside the stock importer files.

  1. Open Blender’s location on your computer. On Windows this is generally 'C:\Program Files\Blender Foundation'

  2. If multiple version numbers are present, open the folder of the version you want to upgrade (for our example here, ‘Blender 3.1’)

  3. Open the ‘3.1’ folder

  4. Open the ‘scripts’ folder

  5. Open the ‘addons’ folder

  6. Open the ‘io_mesh_ply’ folder

  7. Rename '__init__.py' to something like '__init__-OLD.py'

  8. Remame 'import_ply.py' to something like 'import_ply-OLD.py'

  9. Paste in the new __init__.py and import_ply.py from the repository

  10. Restart Blender

This will need to be done once for each version of Blender you would like to use the script with. If you want to revert to the original script, reverse steps 7 and 8.

The install procedure is also contained in Install-v2.pdf and How to Install v2.0.

Usage

Once the scripts are replaced, File->Import will now look like this:

File_Screenshot

Selecting Stanford PLY as Verts will bring up the Filebrowser as usual, with an additional checkbox:

Several things may happen at this point:

  • A triangle/quad mesh file may be loaded as either point cloud (checkbox selected) or mesh (checkbox deselected).

  • A point cloud file may be loaded with the checkbox selected.

  • A point cloud file may be loaded with the checkbox deselected, and the autodetect routine will use the correct loading method.

    • Known Issue:- a bug in the autodetect slows performance as it causes the file to be read twice. Currently working on a fix.

Known Issues

  • The autodetect bug mentioned above.

  • The checkbox occasionally remains checked despite being False under the hood. This is under investigation.

Roadmap

  • Performance can likely be improved. I haven’t looked too deeply into the read() module which is a common bottleneck in file i/o.

  • Exporting Blender objects as verts is not yet supported. Not a huge priority but will be addressed.

  • Various refactoring.

Tutorials

  1. How to Install v2.0

  2. Mandelbulb3D - BTracer2 Workflow Basic

  3. Mandelbulb3D - BTracer2 Workflow Advanced

  4. J-Wildfire

  5. Photogrammetry Rescue with MeshLab and VisualSFM

Blog and References

Under construction

6 Likes

Thanks for sharing.

Very welcome!

1 Like

Does the new point cloud rendering feature of 3.1 bring any changes to this workflow?

It does - it’s even easier! Import your point cloud in as verts and create this Geometry Node tree in the screenshot. That is literally it. I just got this to work and it’s insane. :slight_smile:

Tutorial here: https://youtu.be/K5xH4T_qcec

1 Like

Thanks for your effort.

1 Like

Very welcome! More to follow :slight_smile:

1 Like