Optimize Cutout Geometry Nodes
- Refactor Depth Cutout to reuse the projected outline field, reducing redundant boundary calculations and improving performance. - Derive the center field from shared low-frequency fields, eliminating an unnecessary blur operation. - Implement triangle-only strip cleanup for Depth Cutout, as the input is confirmed to be triangulated. - Short-circuit zero-thickness branches in both Cutout and Depth Cutout to avoid unnecessary geometry generation. - Standardize internal attribute naming with a new `_o_` prefix and implement wildcard cleanup for temporary attributes. - Update relevant tests to ensure functionality remains consistent and validate changes against existing behavior.
This commit is contained in:
@@ -20,7 +20,7 @@ def remove_boundary_triangles(group, geometry):
|
||||
return delete.outputs["Geometry"]
|
||||
|
||||
|
||||
def original_boundary_field(group, original):
|
||||
def original_boundary_field(group, original, rim=None):
|
||||
"""Sample the unsplit outline in UV space after projection and separation."""
|
||||
nodes, links = group.nodes, group.links
|
||||
uv = nodes.new("GeometryNodeInputNamedAttribute")
|
||||
@@ -33,7 +33,8 @@ def original_boundary_field(group, original):
|
||||
nearest.domain = "POINT"
|
||||
links.new(original_uv.outputs["Geometry"], nearest.inputs["Geometry"])
|
||||
links.new(uv.outputs["Attribute"], nearest.inputs["Sample Position"])
|
||||
rim = evaluate_field(group, edge_boundary_field(nodes, links), "FLOAT", "POINT")
|
||||
if rim is None:
|
||||
rim = evaluate_field(group, edge_boundary_field(nodes, links), "FLOAT", "POINT")
|
||||
return sample_field(group, original, rim, "FLOAT", index=nearest.outputs["Index"])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user