Refactor depth surface handling and unify depth sampling rules
- Removed the `always_vertex` parameter from `build_surface_camera` to streamline depth sampling for cutouts and ensure consistent behavior across depth plane and panorama. - Updated depth sampling logic to ensure that all free boundary points, including the original frame of the depth plane, use neighboring face depth instead of their own texture sampling. - Adjusted the depth mask deletion process to operate on faces rather than points, eliminating the need for additional cleanup of dangling edges. - Ensured that the cutout rules are consistently applied across all relevant nodes, removing exceptions and simplifying the logic. - Updated tests to verify the new behavior, ensuring that cutout points follow the depth of adjacent faces and that the original frame maintains its depth sampling. - Refactored geometry handling in multiple depth-related nodes to improve clarity and maintainability.
This commit is contained in:
@@ -1,21 +1,10 @@
|
||||
"""Remove invalid vertices and the wire edges left by point deletion."""
|
||||
"""Delete the faces the depth mask excludes."""
|
||||
|
||||
|
||||
def delete_invalid_points(group, geometry, invalid):
|
||||
def delete_invalid_faces(group, geometry, invalid):
|
||||
nodes, links = group.nodes, group.links
|
||||
delete = nodes.new("GeometryNodeDeleteGeometry")
|
||||
delete.domain, delete.mode = "POINT", "ALL"
|
||||
delete.domain, delete.mode = "FACE", "ALL"
|
||||
links.new(geometry, delete.inputs["Geometry"])
|
||||
links.new(invalid, delete.inputs["Selection"])
|
||||
neighbors = nodes.new("GeometryNodeInputMeshEdgeNeighbors")
|
||||
wire = nodes.new("FunctionNodeCompare")
|
||||
wire.data_type, wire.operation = "INT", "EQUAL"
|
||||
a = next(socket for socket in wire.inputs if socket.identifier == "A_INT")
|
||||
b = next(socket for socket in wire.inputs if socket.identifier == "B_INT")
|
||||
b.default_value = 0
|
||||
links.new(neighbors.outputs["Face Count"], a)
|
||||
cleanup = nodes.new("GeometryNodeDeleteGeometry")
|
||||
cleanup.domain, cleanup.mode = "EDGE", "ALL"
|
||||
links.new(delete.outputs["Geometry"], cleanup.inputs["Geometry"])
|
||||
links.new(wire.outputs["Result"], cleanup.inputs["Selection"])
|
||||
return cleanup.outputs["Geometry"]
|
||||
return delete.outputs["Geometry"]
|
||||
|
||||
Reference in New Issue
Block a user