feat: Implement weight cutout boundary smoothing for image depth cutout
- Added a new proposal for boundary smoothing in the weight cutout process, differentiating between Split edges and Outline smoothing requirements. - Introduced a new capability `cutout-boundary-smoothing` to control smoothing strength and default values. - Updated specifications to define the behavior of boundary-specific smoothing strength and default settings. - Created tasks to verify the implementation of boundary behavior and asset updates. - Developed comprehensive tests for depth symmetry and normal scaling to ensure expected behavior and performance. - Introduced new attributes for normal mapping to facilitate persistent face attributes sharing between depth symmetry and image materials. - Built a new node group for O Image Depth Symmetry, integrating the new smoothing capabilities and ensuring compatibility with existing workflows.
This commit is contained in:
@@ -5,10 +5,12 @@ from .depth_surface import _math
|
||||
from .smoothing import edge_boundary_field, expand_smooth
|
||||
|
||||
|
||||
def boundary_influence(group, protected=False):
|
||||
def boundary_influence(group, protected=False, *, boundary=None):
|
||||
"""Fade a boundary field through two rings while excluding protected points."""
|
||||
nodes, links = group.nodes, group.links
|
||||
boundary = evaluate_field(group, edge_boundary_field(nodes, links), "FLOAT", "POINT")
|
||||
if boundary is None:
|
||||
boundary = edge_boundary_field(nodes, links)
|
||||
boundary = evaluate_field(group, boundary, "FLOAT", "POINT")
|
||||
unprotected = _math(group, "SUBTRACT", 1, protected)
|
||||
cut = _math(group, "MULTIPLY", boundary, unprotected)
|
||||
blur = nodes.new("GeometryNodeBlurAttribute")
|
||||
@@ -75,9 +77,20 @@ def reconstruct_camera_depth(group, camera, depth, smoothed):
|
||||
return choose.outputs[0]
|
||||
|
||||
|
||||
def smooth_cut_boundary(group, geometry, original_boundary=False):
|
||||
"""Blend O Smooth's pinned-boundary result through a two-ring edge mask."""
|
||||
influence = boundary_influence(group, original_boundary)
|
||||
def cut_boundary_influence(group, split_boundary):
|
||||
"""Give split edges full influence and the original outline one tenth."""
|
||||
nodes, links = group.nodes, group.links
|
||||
boundary = evaluate_field(group, edge_boundary_field(nodes, links), "FLOAT", "POINT")
|
||||
split = _math(group, "MULTIPLY", boundary, split_boundary)
|
||||
outline = _math(group, "MAXIMUM", _math(group, "SUBTRACT", boundary, split), 0)
|
||||
split_influence = boundary_influence(group, boundary=split)
|
||||
outline_influence = _math(group, "MULTIPLY", boundary_influence(group, boundary=outline), 0.1)
|
||||
return _math(group, "MAXIMUM", split_influence, outline_influence)
|
||||
|
||||
|
||||
def smooth_cut_boundary(group, geometry, split_boundary=False):
|
||||
"""Blend O Smooth through split and outline masks with distinct weights."""
|
||||
influence = cut_boundary_influence(group, split_boundary)
|
||||
# The support band depends on topology, which stays unchanged in the loop.
|
||||
return expand_smooth(
|
||||
group, geometry, iterations_name="Boundary Smooth", weight_name="Smooth Weight",
|
||||
|
||||
Reference in New Issue
Block a user