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:
@@ -87,18 +87,6 @@ def test_midpoint_selects_relative_ray_jump_and_preserves_faces():
|
||||
assert set(np.round(coords[:, 1], 4)) == {2.0, -2.0}
|
||||
|
||||
|
||||
def test_cleanup_keeps_split_parts_of_a_large_source_island():
|
||||
obj, set_value = surface(wrapper=True)
|
||||
set_value("Cleanup Threshold", 110.0)
|
||||
assert len(evaluated(obj)[1]) == 8
|
||||
set_value("Depth Split", 0.5)
|
||||
assert len(evaluated(obj)[1]) == 8
|
||||
set_value("Thickness", 0.2)
|
||||
assert_closed(evaluated(obj)[1])
|
||||
set_value("Cleanup Threshold", 210.0)
|
||||
assert len(evaluated(obj)[1]) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize("depth_scale", [0.0, 2.0])
|
||||
def test_split_topology_uses_depth_before_display_scaling(depth_scale):
|
||||
obj, set_value = surface(step=4.0)
|
||||
@@ -112,7 +100,7 @@ def test_split_topology_uses_depth_before_display_scaling(depth_scale):
|
||||
|
||||
|
||||
def test_full_wrapper_keeps_closed_shell():
|
||||
obj, set_value = surface(wrapper=True)
|
||||
obj, set_value = surface()
|
||||
set_value("Depth Split", 0.5)
|
||||
set_value("Thickness", 0.2)
|
||||
coords, faces = evaluated(obj)
|
||||
@@ -196,7 +184,7 @@ def test_source_surface_sampling_preserves_depth_on_side_walls():
|
||||
@pytest.mark.parametrize("thickness", [0.0, 0.2])
|
||||
@pytest.mark.parametrize("split", [0.0, 0.5])
|
||||
def test_temporary_fields_are_removed_and_user_attributes_survive(thickness, split):
|
||||
obj, set_value = surface(wrapper=True)
|
||||
obj, set_value = surface()
|
||||
obj.data.attributes.new("o_depth_probe", "FLOAT", "POINT")
|
||||
attribute = obj.data.attributes.new("o_user_weight", "FLOAT", "POINT")
|
||||
obj.data.attributes.new(".o_anyimage_user_weight", "FLOAT", "POINT")
|
||||
|
||||
@@ -94,7 +94,7 @@ def test_saved_parameter_descriptions_match_definitions():
|
||||
thickness = next(item for item in sockets if item.name == "Thickness")
|
||||
direction = next(item for item in sockets if item.name == "Depth Direction")
|
||||
offset = next(item for item in sockets if item.name == "Depth Offset")
|
||||
assert offset.default_value == pytest.approx(1.0)
|
||||
assert offset.default_value == pytest.approx(0.0)
|
||||
assert (offset.min_value, offset.max_value) == (-10.0, 10.0)
|
||||
assert offset.subtype == "DISTANCE"
|
||||
assert direction.parent == thickness.parent == offset.parent
|
||||
|
||||
Reference in New Issue
Block a user