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:
@@ -6,8 +6,8 @@ from ..common.nodes import group_input as _group_input, interface_socket as _int
|
||||
from ..common.nodes import prepare_node_group, float_input
|
||||
from ..common.smoothing import expand_smooth
|
||||
from ..common.depth_surface import (
|
||||
project_depth_surface, thicken_depth_surface, remove_surface_attributes,
|
||||
split_depth_surface, sample_face_camera, store_surface_camera,
|
||||
project_depth_surface, thicken_depth_surface,
|
||||
split_depth_surface, sample_face_camera, build_surface_camera,
|
||||
)
|
||||
|
||||
DEPTH_PLANE_NODE_GROUP_NAME = "O Image Depth Plane"
|
||||
@@ -63,7 +63,7 @@ def build_image_depth_plane_group(image_plane_group):
|
||||
smooth_weight.min_value, smooth_weight.max_value = 0.0, 1.0
|
||||
smooth_weight.subtype = "FACTOR"
|
||||
validity_threshold = _interface_socket(group, "Validity Threshold", "INPUT", "NodeSocketFloat", parent=options)
|
||||
validity_threshold.default_value = 0.1
|
||||
validity_threshold.default_value = 0.9
|
||||
validity_threshold.min_value, validity_threshold.max_value = 0.0, 1.0
|
||||
validity_threshold.subtype = "FACTOR"
|
||||
data = group.interface.new_panel(name="Data", default_closed=True)
|
||||
@@ -122,12 +122,13 @@ def build_image_depth_plane_group(image_plane_group):
|
||||
links.new(delete.outputs["Geometry"], cull.inputs["True"])
|
||||
links.new(plane.outputs["Geometry"], cull.inputs["False"])
|
||||
split_input = _group_input(nodes, {"Split Threshold"})
|
||||
geometry = split_depth_surface(
|
||||
geometry, corner_camera, cut_vertex = split_depth_surface(
|
||||
group, cull.outputs["Output"], sample_face_camera(group, texture_input.outputs["Depth Image"]),
|
||||
split_input.outputs["Split Threshold"], scale_input.outputs["Uniform Scale"],
|
||||
)
|
||||
geometry, camera = store_surface_camera(
|
||||
group, geometry, texture.outputs["Color"], split_input.outputs["Split Threshold"],
|
||||
camera = build_surface_camera(
|
||||
group, texture.outputs["Color"], corner_camera, cut_vertex,
|
||||
split_input.outputs["Split Threshold"],
|
||||
)
|
||||
depth_input = _group_input(nodes, {"Reference Depth", "Depth Scale"})
|
||||
surface = project_depth_surface(
|
||||
@@ -148,10 +149,9 @@ def build_image_depth_plane_group(image_plane_group):
|
||||
choose.input_type = "GEOMETRY"
|
||||
links.new(positive.outputs[0], choose.inputs["Switch"])
|
||||
links.new(surface, choose.inputs["False"])
|
||||
links.new(shell, choose.inputs["True"])
|
||||
clean = remove_surface_attributes(group, choose.outputs["Output"])
|
||||
links.new(shell["geometry"], choose.inputs["True"])
|
||||
geometry = expand_smooth(
|
||||
group, clean, iterations_name="Smooth", weight_name="Smooth Weight",
|
||||
group, choose.outputs["Output"], iterations_name="Smooth", weight_name="Smooth Weight",
|
||||
)
|
||||
smooth = nodes.new("GeometryNodeSetShadeSmooth")
|
||||
smooth.domain = "FACE"
|
||||
|
||||
Reference in New Issue
Block a user