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

@@ -16,7 +16,7 @@ def test_normal_scale_preserves_missing_and_zero_weights(image_layer, engine, do
scene.cycles.device = 'CPU'
scene.cycles.samples = 1
scene.cycles.use_denoising = False
scene.render.resolution_x, scene.render.resolution_y = 256, 64
scene.render.resolution_x, scene.render.resolution_y = 320, 64
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = 'OPEN_EXR'
scene.render.image_settings.color_depth = '32'
@@ -24,14 +24,14 @@ def test_normal_scale_preserves_missing_and_zero_weights(image_layer, engine, do
bpy.ops.object.camera_add(location=(0, 0, 10))
scene.camera = bpy.context.object
scene.camera.data.type = 'ORTHO'
scene.camera.data.ortho_scale = 8
scene.camera.data.ortho_scale = 10
for mode_index, space in enumerate(('TANGENT', 'OBJECT')):
shared = None
for weight_index, weight in enumerate((None, 0.0, 0.4, 1.0)):
column = mode_index * 4 + weight_index
for weight_index, weight in enumerate((None, 0.0, 0.4, 1.0, 2.0)):
column = mode_index * 5 + weight_index
for reference in (False, True):
bpy.ops.mesh.primitive_plane_add(
size=.8, location=(column - 3.5, .5 if reference else -.5, 0),
size=.8, location=(column - 4.5, .5 if reference else -.5, 0),
)
obj = bpy.context.object
obj.data.uv_layers.active.name = 'UVMap'
@@ -71,8 +71,8 @@ def test_normal_scale_preserves_missing_and_zero_weights(image_layer, engine, do
bpy.ops.render.render(write_still=True)
rendered = bpy.data.images.load(scene.render.filepath, check_existing=False)
try:
pixels = np.array(rendered.pixels[:]).reshape(64, 256, 4)
columns = np.arange(8) * 32 + 16
pixels = np.array(rendered.pixels[:]).reshape(64, 320, 4)
columns = np.arange(10) * 32 + 16
np.testing.assert_allclose(pixels[16, columns, :3], pixels[48, columns, :3], atol=2e-4)
assert np.linalg.norm(pixels[16, 16, :3] - pixels[16, 48, :3]) > .01
finally: