Refactor comparison operations in geometry nodes
- Introduced a new `compare_node` function to streamline comparison operations across various geometry nodes. - Replaced instances of mathematical comparison nodes with the new `compare_node` function in multiple files, enhancing code readability and maintainability. - Updated related logic in cutout, depth surface, and image processing groups to utilize the new comparison method. - Ensured consistent handling of boolean logic through the introduction of a `boolean_node` function for combining boolean inputs.
This commit is contained in:
@@ -61,7 +61,9 @@ build_surface_camera(切口点取相邻面深)
|
||||
|
||||
删除改用 FACE 域,并去掉随后的残留边清理。理由是节点链按消费域求值:Plane 的判定链没有固定到点域,切到 FACE 后 UV 属性取该面四角平均,等于在面中心采样深度,因此面中心仍有效的面保留下来,切口不再比阈值轮廓多退一圈;点删除遗留的悬空边也随面删除一并消失,不需要第二次 Delete Geometry。
|
||||
|
||||
Panorama 的判定链在 `evaluate_field(..., "POINT")` 处已固定到点域,面域消费时按四角平均,得到的是「任一顶点无效即删」,删除范围与改动前相同。要让它也按面心判定,需要改用 `face_u` / `face_v` 那套面中心采样(直接平均点域经度会跨 seam 折返),本轮不做。
|
||||
Panorama 的判定链同样改在面心求值:无效采样用面中心经纬(`combine(face_u, face_v)`)取 Closest 纹理,再固定到 FACE 域供删面使用,点域判定只留给「有效区与无效区之间的过渡带」和深度回退。面心经纬由面中心位置反算,不经过点域经度的平均,因此不会在 seam 处折返。判据统一后 Panorama 的切口与 Plane 一样落在面中心轮廓上,不再比阈值轮廓多退一圈。
|
||||
|
||||
面心判定让切口点可能落在无效侧:自身采样无效、但所属面中心有效。这些点由切口规则取相邻面深,所以 `Invalid Distance` 只在 Depth Mask 关闭时生效,判据改为「相邻面过半无效」。无效区连同过渡带一起保留时,无效区的点仍落到背景距离,切口点不再被背景距离顶出去。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
|
||||
@@ -15,14 +15,15 @@
|
||||
|
||||
## 3. 测试
|
||||
|
||||
- [ ] 3.1 Plane:在无效侧写入与有效侧相差一个数量级的深度,断言 mask 切口点跟随相邻面深、不出现尖刺
|
||||
- [ ] 3.2 Panorama:在无效侧写入差异距离,断言切口圈径向距离跟随相邻有效面
|
||||
- [ ] 3.3 断言切口点保持自身射线方向(Plane 相机横纵坐标不变、Panorama 经纬方向不变)
|
||||
- [ ] 3.4 重写 `test_valid_only_deletes_invalid_points_and_wire_edges` 中「删剩点是原几何子集」的断言,改为「切口取相邻面深」,保留 Depth Mask 关闭时逐位不变的对比
|
||||
- [ ] 3.5 断言 Plane 原画幅外框保持自身采样深度,以及不存在相邻保留面的自由点输出坐标有限
|
||||
- [ ] 3.6 运行 `uv run pytest`(至少覆盖 `tests/tools/nodes/test_depth_relief_planes.py`、`test_boundary_depth.py`、`test_depth_surface_split.py`、`test_image_depth_panorama.py`)
|
||||
- [x] 3.1 Plane:在无效侧写入与有效侧相差一个数量级的深度,断言 mask 切口点跟随相邻面深、不出现尖刺(`test_plane_validity_hole_blurs_depth_and_protects_rectangle`)
|
||||
- [x] 3.2 Panorama:在无效侧写入差异距离,断言切口圈径向距离跟随相邻有效面(`test_panorama_blurs_opening_radially_and_keeps_invalid_distance`)
|
||||
- [x] 3.3 断言切口点保持自身射线方向(Plane 相机横纵坐标不变、Panorama 经纬方向不变)
|
||||
- [x] 3.4 把 `test_valid_only_deletes_invalid_points_and_wire_edges` 的保留点断言改为「面中心采样低于 Mask Threshold 才删面」(改名 `test_valid_only_keeps_faces_covering_valid_samples`),保留 Depth Mask 关闭时逐位不变的对比
|
||||
- [x] 3.5 断言 Plane 原画幅外框取相邻面深(`test_outline_points_use_adjacent_face_depth_without_split`),以及不存在相邻保留面的自由点输出坐标有限(`test_validity.py`)
|
||||
- [x] 3.6 运行 `uv run pytest`(至少覆盖 `tests/tools/nodes/test_depth_relief_planes.py`、`test_boundary_depth.py`、`test_depth_surface_split.py`、`test_image_depth_panorama.py`)
|
||||
|
||||
## 4. 资产与收尾
|
||||
|
||||
- [x] 4.1 运行 `uv run node-group build`,确认节点资产构建与校验通过、Capture Attribute 为零
|
||||
- [x] 4.2 检查源码与测试中不再有 `always_vertex` 及旧路径引用,确认最终差异只涉及本次范围
|
||||
- [x] 4.3 `O Image Depth Panorama` 的无效判定改在面心求值,`Invalid Distance` 只在 Depth Mask 关闭时按相邻面生效,并补面心轮廓与切口点半径断言
|
||||
|
||||
Reference in New Issue
Block a user