Page MenuHome

Geometry Nodes: Triangulate Node - Add Selection Input
ClosedPublic

Authored by Johnny Matthews (guitargeek) on Jan 11 2022, 11:10 PM.

Details

Summary

This replaces the minimum vert count with a selection field input. The Face Neighbors -> Vertex Count input node can be used to replicate the minimum size as well as make it able to triangulate based on other conditions such as face size, position, or other datapoint.

T93817

Diff Detail

Repository
rB Blender
Branch
triangle (branched from master)
Build Status
Buildable 19918
Build 19918: arc lint + arc unit

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Jan 11 2022, 11:10 PM
Johnny Matthews (guitargeek) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.Jan 11 2022, 11:34 PM

Thanks for looking into this.

The function in MOD_triangulate can be made static now.
And the annoying part: versioning, this will require adding those two nodes attached to every triangulate node. There is some precedent in the versioning code though.

source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
19–20

Add the BMesh includes in a separate block

55

I think this function could take an IndexMask selection input if it used something like BM_mesh_elem_table_ensure(bm, BM_FACE); and BM_face_at_index

65–67

I think all the handling of custom split normals can be removed, that's not something we've really supported in GN yet (and we have different plans with T93551).

95–98

I guess we could verify that this is still true, since that function isn't used here anymore.

121

With the changes mentioned above, the input mesh can be for_read now I think.

130

has_mesh was already checked above.

This revision now requires changes to proceed.Jan 11 2022, 11:34 PM
Johnny Matthews (guitargeek) marked 5 inline comments as done.

TODO: Versioning Code

Johnny Matthews (guitargeek) marked an inline comment as done.Jan 12 2022, 3:40 PM
source/blender/modifiers/intern/MOD_triangulate.c
51 ↗(On Diff #46983)

This can also be removed.

source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
137

const int

Johnny Matthews (guitargeek) marked 2 inline comments as done.
Hans Goudey (HooglyBoogly) requested changes to this revision.Jan 17 2022, 9:25 PM

This looks good to me, just a few smaller comments.

source/blender/blenloader/intern/versioning_300.c
630 ↗(On Diff #47013)

This has got me in trouble before, I think using nodeFindSocket would be better here too.

2597 ↗(On Diff #47013)

Improve this comment with some reasoning:
. The value is removed before the next step of versioning when the "Mininum Vertices" socket is removed, but its value is necessary in #version_geometry_nodes_update_triangulate_node to create a compare node. The new nodes cannot be added directly here because...

I forget the reason there, I think you mentioned something in chat?

source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
51

static

77–79

Unnecessary change here.

This revision now requires changes to proceed.Jan 17 2022, 9:25 PM
Johnny Matthews (guitargeek) marked 4 inline comments as done.
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenloader/intern/versioning_300.c
2619 ↗(On Diff #47172)

Looks like this loop is now inside the loop you added, probably an error with merging master.

This revision is now accepted and ready to land.Jan 17 2022, 10:13 PM
This revision now requires review to proceed.Jan 17 2022, 10:13 PM
Jacques Lucke (JacquesLucke) requested changes to this revision.Jan 18 2022, 1:26 PM

The versioning seems to be incomplete unfortunately. A few things that could be improved:

  • Only add the additional nodes when Minimum Vertices is larger than 4 and it is not linked.
  • If the Minimum Vertices input was linked, the second input of the new compare node has to be linked as well.

I'm currently thinking about how bad it would be to keep the Minimum Vertices input for now. That way we could separate the decision to add a Selection from the decision to remove Minimum Vertices... That should make this patch simpler for sure.

This revision now requires changes to proceed.Jan 18 2022, 1:26 PM
  • Re-Add Minimum Vertices Input and remove versioning code.
  • Merge branch 'master' into triangle
Hans Goudey (HooglyBoogly) requested changes to this revision.Jan 20 2022, 6:07 PM

We talked about this in the meeting today, and while personally I wasn't excited about it, we agreed that having both inputs is fine for now.

source/blender/nodes/geometry/nodes/node_geo_triangulate.cc
51

Pass mesh by reference instead of by value here

This revision now requires changes to proceed.Jan 20 2022, 6:07 PM
  • Pass mesh by reference.
Johnny Matthews (guitargeek) marked an inline comment as done.Jan 20 2022, 8:46 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 23 2022, 8:28 PM
This revision was automatically updated to reflect the committed changes.