4
$\begingroup$

I come from this question where I have generated a Point Cloud from a simple script which I want to convert into a mesh. I see there is this question and this question, which was unfortunately marked as duplicate even though the thread it supposedly duplicated didn't really have any good answers. And then there is this question where I tried the Point Cloud Skinner addon, but it seems to be outdated for Blender 3.6. I don't see the part where their documentation claims Find the UI of Point Cloud Skinner in Scene panel of Properties window. And the answer that used a Shrink Wrap modifier approach also doesn't work for me for this more complex example.

enter image description here

Then there is MeshLab which seems promising but unfortunately I didn't have any luck because their "latest" documentation seems to be outdated, where many of the methods presented in their documentation don't exist. I tried exporting my point cloud as OBJ and using:

import pymeshlab as ml

ms = ml.MeshSet()

ms.load_new_mesh('C:/Users/harry/Downloads/test.obj')
ms.generate_convex_hull()
ms.save_current_mesh('C:/Users/harry/Downloads/convex_hull.ply')

But that had the same effect as using the Convex Hull node from Geometry Nodes which doesn't really work for a concave shape. You can try installing the module using:

import subprocess
import sys
import os
 
python_exe = os.path.join(sys.prefix, 'bin', 'python.exe')
subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pymeshlab'])
 
print('DONE')

It seems like one of the methods could work in pymeshlab like:

ms = ml.MeshSet()
ms.load_new_mesh('C:/Users/harry/Downloads/test.obj')
ms.generate_surface_reconstruction_screened_poisson()

but that gave me error:

>>> ms.generate_surface_reconstruction_screened_poisson()
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender 3.6\3.6\python\lib\site-packages\pymeshlab\__init__.py", line 41, in foo
    res_dict = self.apply_filter(name, **kwargs)
pymeshlab.pmeshlab.PyMeshLabException: Failed to apply filter: generate_surface_reconstruction_screened_poisson
Details: Filter requires correct per vertex normals.<br>E.g. it is necessary that your <b>ALL</b> the input vertices have a proper, not-null normal.<br> Try enabling the <i>pre-clean<i> option and retry.<br><br>To permanently remove this problem:<br>If you encounter this error on a triangulated mesh try to use the <i>Remove Unreferenced Vertices</i> filterIf you encounter this error on a pointcloud try to use the <i>Conditional Vertex Selection</i> filterwith function '(nx==0.0) && (ny==0.0) && (nz==0.0)', and then <i>delete selected vertices</i>.<br>

Is there any other method I can employ to effectively convert a complex point cloud into a mesh albeit Blender's documentation claiming that not much can be done with a Point Cloud?

Editing

Currently, not much can be done with point clouds; however, they can be converted to/from meshes.

By the way if you are interested in generating this point cloud you can generate it from this simple script:

import bpy
import math as m
import bmesh

mesh = bpy.data.meshes.new("point-cloud-mesh")
obj = bpy.data.objects.new("point-cloud", mesh)

scene = bpy.context.scene
scene.collection.objects.link(obj)

bpy.context.view_layer.objects.active = obj
obj.select_set(True)

bm = bmesh.new()

def get_range(start, end, decimal=0.03, step=1):
    return [v * decimal for v in range(int(start / decimal), int(end / decimal) + 1, step)]

def equation(x, y, z):
    return x**2 + y**2 + z**2 + m.sin(4*x) + m.sin(4*y) + m.sin(4*z) - 1

tolerance = 0.1

for x in get_range(-1, 1):
    for y in get_range(-1, 1):
        for z in get_range(-1, 1):
            result = equation(x, y, z)
            if abs(result) < tolerance:
                v = bm.verts.new((x, y, z))

bm.to_mesh(mesh)
bm.free()
$\endgroup$
6
  • $\begingroup$ You mean like this? i.stack.imgur.com/EOxxc.png $\endgroup$
    – user173853
    Sep 17 at 22:50
  • 1
    $\begingroup$ I immediately recognized the $x^2+y^2+z^2+sin(4x)+sin(4y)+sin(4z)-1 = 0$ :) (not that I remembered the equation) $\endgroup$ Sep 18 at 10:50
  • 1
    $\begingroup$ Maybe this could work blender.stackexchange.com/q/253173/60486 - connect nearby points, fill the edges with triangles (not sure how) $\endgroup$ Sep 18 at 10:52
  • 1
    $\begingroup$ @MarkusvonBroady did that equation look exciting? haha hey thank you for sharing the link, i'll have a look. $\endgroup$ Sep 18 at 10:58
  • 1
    $\begingroup$ True 3D delaunay triangulation is way more complex than 2.5D (which is often used for terrain displacement and easily solved with shrinkwrap or delaunay algorithms) I guess that's why you don't see it in many addons in Blender. You can try CloudCompare and Poisson reconstruction although the result is always an approximation of the real underlying point cloud. i.stack.imgur.com/nxfJv.png $\endgroup$
    – Gorgious
    Oct 9 at 17:14

1 Answer 1

2
$\begingroup$

Use geometry nodes, I know that blender 4.0 comes with a points to curves node, from there you can convert those points to mesh, alternatively you can convert the points to volume and convert to mesh from their.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .