Page MenuHome

Geometry Nodes: Mesh Point Cloud Conversion Nodes
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Sep 28 2021, 6:35 AM.

Details

Summary

This commit adds nodes to do direct conversion between meshes and point
clouds in geometry nodes. The conversion from mesh to points is helpful
to instance once per face, or once per edge, which was previously only
possibly with ugly work-arounds. Fields can be evaluated on the mesh
to pass them to the points with the attribute capture node.

The other conversion, point cloud to mesh vertices, is a bit less
obvious, though it is still a common request from users. It's helpful
for flexibility when passing data around, better visualization in the
viewport (and in the future, cycles), and the simplicity of points.

This is a step towards T91754, where point clouds are currently
combined with meshes when outputing to the next modifier after geometry
nodes. Since we're removing the implicit behavior for realizing
instances, it feels natural to use an explicit node to convert points
to vertices too.

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-point-mesh-conversion (branched from master)
Build Status
Buildable 17358
Build 17358: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Sep 28 2021, 6:35 AM
Hans Goudey (HooglyBoogly) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Sep 28 2021, 10:00 AM

I think the Mesh to Points node should have a position input (that is the position field implicitly). That allows moving the point positions around in the context of the mesh. With that, you can also add a corner mode.

This revision now requires changes to proceed.Sep 28 2021, 10:00 AM
  • Clear other components, add implicit position field
Jacques Lucke (JacquesLucke) requested changes to this revision.Sep 28 2021, 4:29 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
85

Looks like the radius should be a field input.

89

typo

92

Any reason for why you are not evaluating the position directly into the point cloud?

This revision now requires changes to proceed.Sep 28 2021, 4:29 PM
source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
117

Unfortunately, assigning a new geometry set does not work with geometry_set.modify_geometry_sets currently, because that would remove all instances. The instances component has to stay the same. We can think about making this more automatic in the future, but for now that's how it is.

source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
87

This Editable results in a memory leak, because the component assumes that it is owned by someone else. The solution is to just remove the parameter, the default is correct.

Hans Goudey (HooglyBoogly) marked 5 inline comments as done.Sep 28 2021, 5:30 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
85

Good idea! I added another operation to the field tree to make sure the input is above zero.

87

Either I'm missing something, or you're missing that the PointCloudComponent was created one line above just for editing in this scope.

Anyway, I changed this to use the keep_only function you just added.

92

Added a comment about this.

117

Ah, right. Like above, keep_only should fix this.

Hans Goudey (HooglyBoogly) marked 4 inline comments as done.
  • Merge branch 'master' into geometry-nodes-point-mesh-conversion
  • Add radius input, various fixes and comments

LGTM.

I found one issue, but it might be a drawing bug.

This revision is now accepted and ready to land.Sep 28 2021, 6:15 PM