Page MenuHome

Geometry Nodes: Add Mesh to Curve Node
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on May 15 2021, 6:31 AM.
Tokens
"Love" token, awarded by amalbubble."Mountain of Wealth" token, awarded by duarteframos."Love" token, awarded by Bit."Love" token, awarded by Apofis."Love" token, awarded by franMarz."Love" token, awarded by HEYPictures."Burninate" token, awarded by someuser."Burninate" token, awarded by lone_noel.

Details

Summary

This node creates curve splines from mesh edges. A selection attribute
input allows only using some of the edges from the input mesh. The node
builds cyclic splines from branchless groups of edges where possible,
but when there is a three-way intersection, the spline stops.

The algorithm is from Animation Nodes, written by @Omar Emara (OmarSquircleArt).
(find the original pull request here). I added the selection and used different variable
names, etc, but other that the algorithm is the same (in general the way AN
handles splines is fairly similar to node splines in Blender).

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-curve-from-edges (branched from master)
Build Status
Buildable 14581
Build 14581: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.May 15 2021, 6:31 AM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) retitled this revision from Geometry Nodes: Curve from Edges Node to Geometry Nodes: Add Curve from Edges Node.May 16 2021, 2:21 AM
Hans Goudey (HooglyBoogly) planned changes to this revision.May 17 2021, 6:22 PM

Even without supporting dynamic attributes on curves, I should check if there are tilt or radius attributes on the mesh and copy them over.

  • Merge branch 'master' into geometry-nodes-curve-from-edges
  • Copy tilt and radius attributes from mesh
Jacques Lucke (JacquesLucke) requested changes to this revision.May 19 2021, 4:51 PM

Something is wrong here, not sure what it is. The edges on the side are missing when the curve is converted to a mesh with a profile.

Also, the default radius should probably not be zero.

This revision now requires changes to proceed.May 19 2021, 4:51 PM

Interesting, that's a bug with normals calculation, because of the stupid way I chose to calculate Z up normals. I'll look into that, but it's a separate problem.

Has there been any discussion on the naming? Curve from Edges, Edges to Curve, Mesh to Curve, ...

Also got a crash when using an Attribute Fill node after the Curve from Edges node (P2132). Just insert an attribute name in the Attribute Fill node in this file:

source/blender/nodes/geometry/nodes/node_geo_curve_from_edges.cc
78

This can be done now.

  • Rename node to curve to mesh, copy mesh attributes
Hans Goudey (HooglyBoogly) retitled this revision from Geometry Nodes: Add Curve from Edges Node to Geometry Nodes: Add Mesh to Curve Node.May 25 2021, 10:30 PM
source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc
92 ↗(On Diff #37488)

This assert is hit for me when I have a mesh without faces that has a face attribute. Example:


I think the fix is to remove this from MeshComponent::attribute_try_adapt_domain:

if (varray->size() == 0) {
  return {};
}

Does that sound fine to you?

182 ↗(On Diff #37488)

typo (edges)

Hans Goudey (HooglyBoogly) marked 2 inline comments as done.
  • Merge branch 'master' into geometry-nodes-curve-from-edges
  • Fix type, add null attribute check
source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc
92 ↗(On Diff #37488)

I think that would be fine. Not necessarily better though, and in this case I'd rather not add such attributes at all. Since they don't contain any data, they are like "ghost" attributes.

I just added the check here.

Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_mesh_to_curve.cc
92 ↗(On Diff #37488)

If we don't add these attributes, we have to be more careful with error messages. Afaik we still often get error messages for attributes that would be there if we wouldn't "optimize" them away.. Personally, I'm not so sure about the fact that these "ghost attributes" are bad, they make things more predictable imo.

This revision is now accepted and ready to land.May 28 2021, 3:34 PM
This revision was automatically updated to reflect the committed changes.