Add new functionality for image rectification and depth metadata handling
- Implemented a preview tool for rectifying images with interactive aspect controls in `preview.py`. - Added tests for depth metadata loading to ensure consistent schema usage in `test_depth_metadata.py`. - Developed comprehensive tests for cutout calibration processes in `test_cutout_calibration.py`, including stability checks and depth calibration. - Created tests for frame compositing operations in `test_frame_compositing.py`, ensuring correct handling of depth and transparency. - Introduced material slot inheritance functionality in `material_slots.py` to manage geometry material assignments. - Built shared shader nodes for material processing in `shader.py`, including roughness and bump mapping setups.
This commit is contained in:
@@ -35,7 +35,7 @@ def set_test_structure(monkeypatch, value):
|
||||
monkeypatch.setattr(image_depth_cutout, "build_front_fields", fields)
|
||||
|
||||
|
||||
def test_uniform_thickness_follows_the_tilted_front_normal():
|
||||
def test_shell_thickness_extends_behind_the_tilted_front():
|
||||
from scipy.spatial import cKDTree
|
||||
from tests.support.depth_surface import surface, evaluated, assert_closed
|
||||
obj, set_value = surface(step=0, resolution=4)
|
||||
@@ -48,6 +48,7 @@ def test_uniform_thickness_follows_the_tilted_front_normal():
|
||||
bpy.context.view_layer.update()
|
||||
front, _ = evaluated(obj)
|
||||
set_value("Thickness", 0.2)
|
||||
set_value("Front Inflation", 0.5)
|
||||
points, faces = evaluated(obj)
|
||||
expected = front - 0.2 * np.array((0.4, 0, 1)) / np.sqrt(1.16)
|
||||
assert cKDTree(points).query(expected)[0].max() < 1e-5
|
||||
@@ -140,12 +141,12 @@ def test_depth_cutout_normal_map_only_affects_front_faces():
|
||||
evaluated.to_mesh_clear()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("structure", [0, 1, 4])
|
||||
@pytest.mark.parametrize("thickness", [0.0, 0.02, 0.1])
|
||||
@pytest.mark.parametrize("inflation", [0.0, 0.0001, 0.5, 1.0])
|
||||
def test_uniform_front_inflation_scales_with_distance(thickness, structure, inflation, monkeypatch):
|
||||
@pytest.mark.parametrize("thickness,inflation", [
|
||||
(0.0, 1.0), (0.02, 0.0), (0.02, 0.0001),
|
||||
(0.02, 0.5), (0.1, 0.5), (0.1, 1.0),
|
||||
])
|
||||
def test_shell_ignores_front_inflation(thickness, inflation):
|
||||
from tests.support.depth_surface import surface, evaluated, assert_closed
|
||||
set_test_structure(monkeypatch, structure)
|
||||
obj, set_value = surface(step=0, resolution=10)
|
||||
xy = np.array([v.co[:2] for v in obj.data.vertices])
|
||||
profile = 0.3 * np.sin(np.pi * xy[:, 0] / 2) * np.sin(np.pi * xy[:, 1])
|
||||
@@ -157,14 +158,9 @@ def test_uniform_front_inflation_scales_with_distance(thickness, structure, infl
|
||||
set_value("Front Inflation", inflation)
|
||||
inflated, inflated_faces = evaluated(obj)
|
||||
assert faces == inflated_faces
|
||||
delta = np.linalg.norm(inflated - baseline, axis=1)
|
||||
front = np.isclose(baseline[:, 2], baseline[:, 2].max(), atol=1e-6)
|
||||
np.testing.assert_allclose(delta[front], thickness * inflation, atol=2e-6)
|
||||
np.testing.assert_allclose(delta[~front], 0, atol=2e-6)
|
||||
np.testing.assert_array_equal(inflated, baseline)
|
||||
if thickness:
|
||||
assert_closed(inflated_faces)
|
||||
else:
|
||||
np.testing.assert_array_equal(inflated, baseline)
|
||||
|
||||
|
||||
def test_balloon_suppression_is_stronger_without_a_startup_threshold(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user