Files
AnyImage/docs/depth-plane.md
nan 988332548e Add tests for clipboard image functionality and mesh plane asset creation
- Implemented a comprehensive test suite for the clipboard image module, covering various functionalities including operator registration, context handling, and image processing.
- Created a new mesh plane asset with customizable parameters and integrated it into the geometry node system.
- Developed a validation script to ensure the correct behavior of the mesh plane asset, including input handling and output verification.
2026-08-22 09:49:00 +08:00

2.8 KiB
Raw Blame History

Depth Plane

Depth Plane 把图片映射为带深度位移的面片,适合快速获得可调节的立体效果。操作方法见Depth Plane 使用指南。

数据流

flowchart LR
    Input["Image Empty"] --> Depth{"深度来源"}
    Depth --> DA3["DA3"]
    Depth --> MoGe["MoGe-2"]
    Depth --> Original["Original"]
    DA3 --> Layers["颜色层 + 深度层"]
    MoGe --> Layers
    Original --> Layers
    Layers --> Import["Blender 导入"]
    Import --> Mesh["基础面片"]
    Import --> Nodes["Geometry Nodes"]
    Import --> Material["材质"]

Server 为每帧准备颜色、深度和可选前景 Alpha。Blender 导入这些数据,创建基础面片,并用 Geometry Nodes 与材质分别完成几何位移和表面细节。

深度来源

来源 深度含义 额外数据 适合
DA3 相对深度 相机内参与置信度 通用单图与动画
MoGe-2 Metric depth 法线、Mask、相机内参 更稳定的尺度与表面法线
Original 原图亮度 可选 BEN2 Alpha 已准备好高度图的素材

DA3 和 MoGe-2 都以未经抠图的 RGB 估计深度。启用 Remove Background 后,BEN2 只分析输入 Alpha 内的可见 RGB,颜色 Alpha 使用“输入 Alpha × BEN2 Alpha”,并作为前景 Mask;深度本身保持模型输出。

视频与序列帧逐帧推理并复用同一个模型 Session,因此显存主要由单帧分辨率决定。DA3 Debug 的多帧联合推理属于另一条工作流。

Blender 结果

转换会创建以下数据:

  • 与源 Image Empty 对齐的面片
  • .depth 与 .color Image datablock
  • 使用 O DA3 Depth Plane 或 O MoGe2 Depth Plane 的 Geometry Nodes 修改器
  • 连接颜色、Alpha、Bump 与材质位移的材质

Geometry Nodes 提供深度范围、细分、重拓扑、平滑、背景深度和位移强度等控制。深度 Mask 在几何和材质路径中使用相同阈值,以保持轮廓一致。

材质与图片名称以源 Image datablock 为基名。对象 Transform、显示尺寸和 Offset 会转换为面片的空间位置与比例。

单图与动画文件

单图深度使用 OpenEXR Pack 到 .blend,以保留浮点范围。Packed Image 会先导出临时输入,任务结束后清理,源 Image 保持不变。

动画使用 Job 目录中的外部序列:

<job-id>/
├── color.0001.jpg/png
├── depth.0001.exr
└── results.npz

MoGe-2 动画的深度序列使用 moge_depth.0001.exr。这些文件是 .blend 的运行时依赖,详见动画与序列帧。

适用范围

Depth Plane 是固定平面上的深度位移,不是完整的逐像素 camera-space 重建。它强调可编辑性和动画支持;需要透视网格时使用 Surface。