Refactor depth reference handling and cleanup

- Unified reference depth calculation to use a single implementation in common/depth.py.
- Removed server-side reference depth computation and adjusted depth.json to only include image_size and intrinsics.
- Updated depth texture handling to ignore transparent, invalid, and non-positive pixels when calculating reference depth.
- Changed reference depth calculation to use the 95th percentile of valid depth values.
- Adjusted depth direction fitting to return a flat direction when no samples are available.
- Removed cleanup threshold parameters from Cutout and related nodes, simplifying the interface.
- Updated tests to verify new reference depth logic and ensure compatibility with existing functionality.
This commit is contained in:
2026-09-15 22:50:16 +08:00
parent 94130ff38f
commit 2dfa9b2add
37 changed files with 665 additions and 639 deletions

View File

@@ -143,7 +143,6 @@ def test_converted_planes_center_the_origin_without_moving_world_corners():
_depth_metadata(
((0.5, 0.0, 0.5), (0.0, 0.5, 0.5), (0.0, 0.0, 1.0)),
(2, 2),
1.0,
),
"DEPTH",
)
@@ -192,7 +191,6 @@ def test_relief_plane_builds_a_fixed_base_terrain_block():
_depth_metadata(
((1.5, 0.0, 1.5), (0.0, 1.5, 1.5), (0.0, 0.0, 1.0)),
(4, 4),
1.0,
),
"RELIEF",
)
@@ -208,7 +206,7 @@ def test_relief_plane_builds_a_fixed_base_terrain_block():
] == 0.5
assert modifier[
object_data.modifier_input_identifier(group, "Depth Offset")
] == 1.0
] == 0.0
def set_input(name, value):
object_data.set_modifier_input(
@@ -299,7 +297,6 @@ def test_relief_plane_initializes_a_fitted_depth_direction():
metadata = _depth_metadata(
((2.0, 0.0, 2.0), (0.0, 2.0, 1.0), (0.0, 0.0, 1.0)),
(5, 3),
2.0,
)
result = plane_object.create_depth_plane_object(
bpy.context,