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:
2026-09-14 12:44:20 +08:00
parent 09778c4b48
commit dc000e50b1
53 changed files with 1350 additions and 364 deletions

View File

@@ -5,10 +5,7 @@ from enum import StrEnum
import bpy
from ...common.depth import camera_depth_values, depth_uniform_scale
from ...common.material import (
IMAGE_MATERIAL_NODE_GROUP_NAME,
create_image_material,
)
from ...common.material import create_image_material
from ...common.object import (
finalize_object_result,
modifier_input_identifier,
@@ -18,7 +15,7 @@ from ...common.node import load_node_group
from .depth_calibration import (
DEFAULT_DEPTH_BASELINE,
DEFAULT_DEPTH_DIRECTION,
depth_balloon_projection_parameters,
depth_symmetry_projection_parameters,
metric_depth_reference,
use_adaptive_depth_calibration,
)
@@ -31,7 +28,6 @@ from .geometry import (
)
from .shape import (
BALLOON_ATTRIBUTE_NAME,
NORMAL_SCALE_ATTRIBUTE_NAME,
CUTOUT_NODE_GROUP_NAMES,
DEPTH_CUTOUT_SHAPES,
)
@@ -75,24 +71,6 @@ def load_cutout_node_group(shape):
return load_node_group(CUTOUT_NODE_GROUP_NAMES[shape])
def _connect_cutout_normal_scale(material):
nodes = material.node_tree.nodes
image_layer = next(
node
for node in nodes
if node.bl_idname == "ShaderNodeGroup"
and node.node_tree is not None
and node.node_tree.name == IMAGE_MATERIAL_NODE_GROUP_NAME
)
attribute = nodes.new("ShaderNodeAttribute")
attribute.attribute_type = "GEOMETRY"
attribute.attribute_name = NORMAL_SCALE_ATTRIBUTE_NAME
attribute.location = (-550.0, -250.0)
material.node_tree.links.new(
attribute.outputs["Fac"], image_layer.inputs["Normal Scale"]
)
def create_shape_object(
context,
source_object,
@@ -143,7 +121,6 @@ def create_shape_object(
scene=context.scene,
)
depth_reference = None
_connect_cutout_normal_scale(material)
uniform_scale = None
depth_direction = None
if shape in DEPTH_CUTOUT_SHAPES:
@@ -161,7 +138,7 @@ def create_shape_object(
)
if not use_adaptive_depth_calibration(transparent_fraction):
depth_reference = DEFAULT_DEPTH_BASELINE
if shape == "DEPTH_BALLOON":
if shape == "DEPTH_SYMMETRY":
depth_direction = DEFAULT_DEPTH_DIRECTION
elif shape == "DEPTH_SOLID":
depth_reference = metric_depth_reference(
@@ -170,7 +147,7 @@ def create_shape_object(
uniform_scale,
)
else:
depth_reference, depth_direction = depth_balloon_projection_parameters(
depth_reference, depth_direction = depth_symmetry_projection_parameters(
base_shape.vertices,
base_shape.uv,
camera_depth,
@@ -222,7 +199,7 @@ def create_shape_object(
),
value,
)
if shape in {"FLAT", "SOLID", "DEPTH_SOLID"} and gesture == "POLYLINE":
if gesture == "POLYLINE" and shape != "DEPTH_SYMMETRY":
set_modifier_input(
modifier,
modifier_input_identifier(node_group, "Mode"),
@@ -246,7 +223,7 @@ def create_shape_object(
modifier_input_identifier(node_group, name),
value,
)
if shape == "DEPTH_BALLOON":
if shape == "DEPTH_SYMMETRY":
set_modifier_input(
modifier,
modifier_input_identifier(node_group, "Depth Direction"),