Files
AnyImage/openspec/changes/unify-boundary-depth-smoothing/specs/boundary-depth-smoothing/spec.md
nan 31074bd511 Add tests and implement boundary smoothing and cutout functionality
- Introduced tests for boundary smoothing in `test_boundary_smoothing.py`, verifying that smoothing reduces stair-step artifacts while preserving boundary integrity.
- Added tests for cutout boundary behavior in `test_cutout_boundary.py`, ensuring proper handling of boundary triangles and normal blending.
- Created `test_temporary_attributes.py` to check the cleanup of temporary attributes across depth modifier branches, ensuring no warnings are raised.
- Implemented point culling functionality in `test_validity.py`, confirming that invalid points are removed without affecting adjacent geometry.
- Developed boundary smoothing logic in `boundary_smoothing.py`, allowing for depth smoothing while maintaining edge integrity.
- Added cutout boundary management in `cutout_boundary.py`, including functions for removing boundary triangles and tapering thickness profiles.
- Implemented validity checks in `validity.py` to ensure proper deletion of invalid vertices and associated wire edges.
2026-09-11 20:37:20 +08:00

4.7 KiB
Raw Blame History

ADDED Requirements

Requirement: Shared Boundary Smooth control

O Image Depth Cutout、O Image Depth Plane、O Image Depth Panorama SHALL 使用同一 Boundary Smooth 输入控制边界深度 Blur 和现有边界网格平滑的迭代数,默认值为 5,范围为 0–20,并保留该输入的既有标识。

Scenario: Positive iteration count

  • WHEN 用户将任一组的 Boundary Smooth 设为 12
  • THEN 深度 Blur 和现有边界网格平滑均使用 12 次迭代
  • AND 修改器只提供现有 Boundary Smooth 控制项

Scenario: Disabled smoothing

  • WHEN Boundary Smooth 为 0
  • THEN 输出几何与两种边界平滑均关闭的基线一致
  • AND 深度采样直接使用原值

Requirement: Topology-local scalar smoothing

系统 SHALL 在有效性剔除及 Split 后、投影前的网格 Point 域对深度标量执行 Weight 为 0.5 的 Blur,并在可处理边界及邻近两圈内应用结果。边界影响权重 SHALL 由边界字段的 2 次 Weight 为 1 的 Blur 与原边界字段取最大值后,排除保护点得到。

Scenario: Isolated boundary spike

  • WHEN 原本平缓的表面在一个可处理边界点具有深度尖刺并启用 Boundary Smooth
  • THEN 深度突变通过当前网格邻域的标量平均减弱
  • AND 深度平滑阶段的顶点、边、面及 UV 拓扑保持不变

Scenario: Interior preservation

  • WHEN 顶点位于影响范围之外
  • THEN 深度平滑阶段直接保留其原采样值

Scenario: Deleted and separated samples

  • WHEN 邻近像素所属网格已被有效性剔除,或邻接表面已由 Split 分离
  • THEN 平滑仅使用当前连通网格的样本,不跨已删区域或分离表面平均

Requirement: Cutout silhouette depth smoothing

Depth Cutout SHALL 将原 Alpha 轮廓和 Split 后的新边界纳入深度平滑,并保留现有后置网格平滑的原轮廓保护规则。

Scenario: Fine Outline with zero thickness

  • WHEN Fine Outline 的原轮廓存在异常深度,Thickness 为 0 且 Boundary Smooth 大于 0
  • THEN 原轮廓点的深度参与平滑
  • AND 深度平滑后的相机投影轮廓在浮点容差内保持一致

Requirement: Depth Plane rectangle protection

Depth Plane SHALL 对有效性剔除或 Split 形成的可处理边界应用深度平滑,并同时从边界起点和最终应用权重中排除原 UV 矩形外框。

Scenario: Alpha or model-validity opening

  • WHEN Valid Only 因 Alpha 或模型 validity 删除网格并形成新开口
  • THEN 新开口及邻近两圈参与深度平滑
  • AND 保留下来的原矩形外框点保持既有保护行为

Scenario: Intact rectangle

  • WHEN Valid Only 和 Split 均关闭,网格仅有原矩形外边界
  • THEN 新增深度 Blur 对输出不产生变化

Requirement: Projection-aware reconstruction

Cutout 和 Depth Plane SHALL 在深度平滑阶段保持原相机射线,通过平滑后的 Z 重建相机点;Depth Panorama SHALL 平滑径向距离并保持原球面方向。方向保持以现有后置网格平滑之前的结果为准。

Scenario: Camera depth reconstruction

  • WHEN 正的有效相机 Z 被平滑
  • THEN 新旧相机点的 X/Z、Y/Z 在浮点容差内一致

Scenario: Degenerate camera depth

  • WHEN 原采样 Z 无法安全用于比例重建
  • THEN 保留原采样,不因深度平滑产生非有限值

Scenario: Panorama seam and poles

  • WHEN 有效表面跨越经度接缝或覆盖极点
  • THEN 深度 Blur 使用实际球面邻接,不将 UV 接缝当作网格开口
  • AND 径向重建保持每个点的球面方向

Scenario: Retained invalid panorama region

  • WHEN Panorama 保留无效区域并使用 Invalid Distance
  • THEN 无效区域继续使用指定距离
  • AND 无效替代距离不混入有效边界的深度平均

Requirement: Integrated geometry and asset verification

系统 SHALL 保持厚度、Split、Depth Scale、UV、材质和用户属性的既有职责,所有几何节点及嵌套组 MUST 保持 Capture Attribute 为零。更新后的节点源码、行为测试及保存资产 SHALL 一致。

Scenario: Surface modes and downstream shaping

  • WHEN 三个深度表面组合使用边界平滑与自身支持的 Split、Depth Scale、厚度或 Cutout 模式
  • THEN 输出为有效几何,属性和材质传递符合原有协议
  • AND 深度平滑不改变有效性剔除与 Split 的拓扑判定

Scenario: Rebuilt asset

  • WHEN 执行节点资产构建并在独立 Blender 进程中重新加载保存资产
  • THEN 资产与源码构建结果通过相同的行为验证
  • AND 公共参数、节点连接和 Capture 禁用检查通过