This adds an input to the Subdivision node to specify a field to use
for controling vertex creases. Common code with edge creasing was
extracted into utility functions to avoid redundancy.
Details
Diff Detail
- Repository
- rB Blender
- Branch
- vertex_crease_subdiv_node_input (branched from master)
- Build Status
Buildable 20734 Build 20734: arc lint + arc unit
Event Timeline
| source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc | ||
|---|---|---|
| 24 | This change will require versioning to maintain compatibility with older files. See usage of version_node_input_socket_name() | |
Fine from my POV but will let Hans comment on anything specific to the geometry nodes.
Adding an input to the node seems very useful. Personally I would be ready to accept this if it didn't depend on the patch that exposed vertex_crease as a builtin attribute (this could just set CD_CREASE directly).
I think there are still unresolved questions with that, and I'm still not convinced it should be a builtin attribute.
Basically I'd suggest dropping the other patch for now and relying on improvements to generic attribute editing in edit mode for that part.
This patch could evaluate its vertex crease input field and use something like this logic to write to the CD_CREASE layer:
if (!(vertex_creases.is_single() && vertex_creases.get_internal_single() == 0.0f)) {
vertex_creases.materialize("CD_CREASE span")| source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc | ||
|---|---|---|
| 67 | Nodes should generally only do a single field evaluation if possible, in case any of the field network is shared between the inputs. | |
This would require using the ID attribute API as the attribute providers could not then create a CD_CREASE layer.
| source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc | ||
|---|---|---|
| 67 | Is this an information for other future patches, or a requested change? For the latter, how would it work if the number of vertices and do not match (which is most likely)? | |
I think that's okay here, since it's really just meant as an input to the subdivision surface modifier.
Though actually I think it would use the CustomData API, since the CD_CREASE layer isn't a named "generic" attribute.
| source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc | ||
|---|---|---|
| 67 | Oh right, sorry, I missed that this had to evaluate on two separate domains. | |
I think this works, but I'd like to propose some changes just from a code simplicity perspective. I made some changes in P2910.
- Don't use the same function for edge and vertex creases, since they don't really share much logic except for clamping.
- Multithread writing and clamping of creases.
- Avoid retrieving write access if not necessary, to avoid duplicating mesh data.
- Use CustomData API instead of ID attribute API, since vertex creases aren't a generic layer.
- Slightly simplify code / avoid redundant logic.
Let me know if the diff in that paste looks okay to you.
Apply changes from Hans' patch. I don't see any issues with them
and everything seems to work fine.
LGTM.
General question: is it expected that the subdivided mesh changes a little bit suddenly when the crease is set to 0 compared to e.g. 0.003?
