feat(cutout): implement boundary padding for cutout textures

- Introduced a new `Boundary Padding` preference in the Cutout Tool with a default of 2 px and a configurable range of 1-4 px.
- Updated the Cutout client to establish inward mapping from the final Mask, sampling in a fixed direction and processing independent material RGBA and Depth.
- Enhanced the handling of RGBA and Depth during cutout operations, ensuring proper mapping and preservation of source data.
- Added tests to validate the new boundary padding functionality and its integration with existing cutout processes.

feat(geometry): remove overall mesh smoothing from geometry nodes

- Removed the `Smooth` input from several geometry node groups to eliminate unnecessary overall mesh smoothing.
- Retained `Smooth Weight` for depth nodes while removing it from Cutout and Relief Plane nodes.
- Ensured that boundary, normal, and fill smoothing behaviors remain intact and consistent.
- Updated tests and documentation to reflect the changes in node interfaces and behaviors.

feat(normals): scale tangent normals with depth

- Reused the existing `o_normal_reduction` attribute to adjust Tangent Normal strength based on the geometry's `Depth Scale`.
- Ensured that Tangent Normal strength is consistent with the geometry depth, preserving full strength for materials that do not provide the attribute.
- Updated tests to verify the correct behavior of normal strength adjustments in both Tangent and Object Space.
This commit is contained in:
2026-09-15 00:40:24 +08:00
parent ab282e4fdf
commit 591e62085a
93 changed files with 1915 additions and 2851 deletions

View File

@@ -58,9 +58,8 @@ def test_alpha_resize_retains_threshold_values(tmp_path):
(False, "OBJECT"),
],
)
@pytest.mark.parametrize("extend_depth_edges", [False, True])
def test_artifacts_extend_only_requested_depth_and_preserve_normals(
tmp_path, generate_depth, normal_mode, extend_depth_edges
def test_artifacts_write_raw_requested_depth_and_preserve_normals(
tmp_path, generate_depth, normal_mode
):
frame, alpha = silhouette()
rgba = np.full((*alpha.shape, 4), 255, np.uint8)
@@ -85,14 +84,11 @@ def test_artifacts_extend_only_requested_depth_and_preserve_normals(
patch.object(
artifacts, "_write_normal", return_value=tmp_path / "normal.png"
) as normal,
patch.object(artifacts, "extend_edge_depth", wraps=artifacts.extend_edge_depth) as extend,
):
artifacts.generate_moge_artifacts(
context, {}, path, generate_depth=generate_depth, normal_mode=normal_mode,
**({"extend_depth_edges": True} if extend_depth_edges else {}),
)
infer.assert_called_once()
assert extend.call_count == int(generate_depth and extend_depth_edges)
if normal_mode != "NONE":
assert normal.call_args.args[0] is frame
else:
@@ -101,10 +97,8 @@ def test_artifacts_extend_only_requested_depth_and_preserve_normals(
written_frame = depth.call_args.args[0]
np.testing.assert_array_equal(depth.call_args.kwargs["alpha"], alpha)
assert metadata.call_args.args[0] is written_frame
assert (written_frame is frame) == (not extend_depth_edges)
assert written_frame.depth[12, 24] == (2 if extend_depth_edges else 20)
assert written_frame is frame
assert frame.depth[12, 24] == 20
assert written_frame.validity is frame.validity
else:
metadata.assert_not_called()
depth.assert_not_called()