Page MenuHome

Geometry Nodes: Subdivision Surface Node
ClosedPublic

Authored by Jarrett Johnson (jarrett.johnson) on Oct 11 2021, 8:38 PM.

Details

Summary

Replaces the old Subdivision Surface Node.

Changes:

  • Removes implicit instance realization
  • Use_creases becomes a Crease Factor field applied to edges.

Addresses T91763

Diff Detail

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

Event Timeline

Jarrett Johnson (jarrett.johnson) created this revision.
  • move macro outside of lambda callback
Jarrett Johnson (jarrett.johnson) retitled this revision from use_creases from field to Subdivision Surface Node.Oct 11 2021, 8:57 PM
Jarrett Johnson (jarrett.johnson) edited the summary of this revision. (Show Details)
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
96–107

I guess I wasn't totally clear before, sorry about that, but the crease should be evaluated as a float and stored in the MEdge.crease (or passed to the subdivision process in some other way) if it's necessary (the use_creases condition hear evaluates to true). Otherwise it don't be possible to use different crease values for every vertex.

Jarrett Johnson (jarrett.johnson) retitled this revision from Subdivision Surface Node to Geometry Nodes: Subdivision Surface Node (WIP).Oct 12 2021, 6:37 PM
Jarrett Johnson (jarrett.johnson) edited the summary of this revision. (Show Details)
Jarrett Johnson (jarrett.johnson) edited the summary of this revision. (Show Details)
  • Merge branch 'master' into mesh_subdivision
  • crease factor
Jarrett Johnson (jarrett.johnson) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
96–107

It makes much more sense now. Thanks.

Still WIP for now, but seems workable. I want to test the smoothing modes first before I add reviewers.

Jarrett Johnson (jarrett.johnson) retitled this revision from Geometry Nodes: Subdivision Surface Node (WIP) to Geometry Nodes: Subdivision Surface Node.Oct 14 2021, 7:34 AM
Jarrett Johnson (jarrett.johnson) edited the summary of this revision. (Show Details)
Jacques Lucke (JacquesLucke) requested changes to this revision.Oct 14 2021, 12:48 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
96
[1/3] Building CXX object source/blender/nodes/CMakeFiles/bf_nodes.dir/geometry/nodes/node_geo_subdivision_surface.cc.o
/home/jacques/blender-git/blender/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc:102:5: warning: 'auto &creases' can be declared as 'const auto &creases' [readability-qualified-auto]
    auto &creases = evaluator.get_evaluated<float>(0);
    ^
    const

Use the type name instead of auto.

99
  • This has to clamp the crease, otherwise the behavior is weird when the value is out of range.
  • This also overwrites the crease attribute on the mesh which isn't great (as it is observable in the spreadsheet) but it's not a deal breaker.
  • This overwrites a referenced custom data layer in my simple test. The solution is add mesh_in->medge = (MEdge *)CustomData_duplicate_referenced_layer( &mesh_in->edata, CD_MEDGE, mesh_in->totedge); or to use the attribute api to set the crease.

To see the bug, change the second input in the Add node.

This revision now requires changes to proceed.Oct 14 2021, 12:48 PM
  • attribute api
  • remove auto and reformat file
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc
92

And an empty line before here and after const VArray<float> &creases = evaluator.get_evaluated<float>(0);.
This just makes the code a bit easier to scan.

This revision is now accepted and ready to land.Oct 15 2021, 11:39 AM
  • Add spaces for readability

This is a nice intuitive way to control the crease, I like it. Thanks for the patch Jarrett!

I'll do a few small cleanups when committing:

  • No need for two separate mesh component variables
  • Rename a few variables slightly
  • Add PROP_FACTOR to crease input so it draws with a slider.

I also renamed "Crease Factor" to "Crease". Having "Factor" in the name implied that it's multiplied with something, which isn't true.