Refactor geometry node groups for image depth processing
- Introduced new utility functions in common nodes for evaluating fields and capturing attributes. - Simplified volume field calculations in image depth cutout and panorama groups by utilizing new utility functions. - Enhanced readability and maintainability of the image depth cutout and panorama node groups by removing redundant code and improving function usage. - Adjusted default values for thickness and depth scale in image relief plane group for better user experience. - Improved handling of geometry attributes and connections in image depth plane group to streamline processing.
This commit is contained in:
@@ -144,6 +144,22 @@ def test_relief_reads_z_and_keeps_the_base(relief, thickness):
|
||||
assert obj.modifiers[0][inputs["Thickness"].identifier] == pytest.approx(thickness)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("reference", [0.5, 1.25, 2.0])
|
||||
def test_zero_thickness_relief_keeps_far_depth_at_object_space_zero(relief, reference):
|
||||
obj, set_value, _, _, _ = relief
|
||||
base = evaluated(obj)
|
||||
texel_x = np.clip((base[0][:, 0] + 2) / 4 * 16, 0.5, 15.5)
|
||||
depth = (2 + texel_x / 16) * 0.5
|
||||
expected = np.maximum((reference - depth) * 1.5, 0)
|
||||
set_value("Reference Depth", reference)
|
||||
set_value("Depth Scale", 1.5)
|
||||
result = evaluated(obj)
|
||||
np.testing.assert_allclose(result[0][:, 2], expected, atol=1e-6)
|
||||
np.testing.assert_array_equal(result[0][:, :2], base[0][:, :2])
|
||||
assert result[1] == base[1]
|
||||
np.testing.assert_array_equal(result[2], base[2])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("normal_smooth", [0, 2, 50])
|
||||
def test_curved_shell_smooths_normals_without_shrinking_thickness(surface, normal_smooth):
|
||||
from scipy.spatial import cKDTree
|
||||
@@ -197,7 +213,7 @@ def test_surface_interface_and_node_structure(surface):
|
||||
assert inputs["Split Threshold"].subtype == "FACTOR"
|
||||
assert inputs["Split Threshold"].parent == inputs["Smooth"].parent
|
||||
assert inputs["Split Threshold"].parent.name != "Options"
|
||||
assert inputs["Validity Threshold"].default_value == pytest.approx(0.1)
|
||||
assert inputs["Validity Threshold"].default_value == pytest.approx(0.9)
|
||||
assert inputs["Validity Threshold"].parent.name == "Options"
|
||||
assert inputs["Validity Threshold"].subtype == "FACTOR"
|
||||
assert inputs["Valid Only"].default_value is True
|
||||
@@ -223,9 +239,9 @@ def test_relief_interface_and_node_structure(relief):
|
||||
obj, _, _, inputs, _ = relief
|
||||
assert list(inputs) == ["Geometry", "Subdivide", "Thickness", "Depth Scale",
|
||||
"Reference Depth", "Uniform Scale", "Depth Image"]
|
||||
assert inputs["Thickness"].default_value == 0
|
||||
assert inputs["Thickness"].default_value == 0.5
|
||||
assert inputs["Subdivide"].default_value == 6
|
||||
assert inputs["Depth Scale"].default_value == 1
|
||||
assert inputs["Depth Scale"].default_value == 0.5
|
||||
assert all(item.structure_type == "SINGLE" for item in inputs.values())
|
||||
assert inputs["Thickness"].subtype == inputs["Reference Depth"].subtype == "DISTANCE"
|
||||
assert inputs["Uniform Scale"].hide_in_modifier and inputs["Depth Image"].hide_in_modifier
|
||||
|
||||
Reference in New Issue
Block a user