Files
AnyImage/docs/depth-plane.md
nan 6c8358f92f Refactor image processing and cutout functionalities
- Updated the naming convention for upscaled images to include underscores and file extensions.
- Renamed properties related to cutout pixel size to point spacing for clarity.
- Adjusted alpha region calculations to use a half-alpha threshold for better accuracy.
- Enhanced the handling of foreground mesh masks to consider half-alpha values.
- Introduced new functions for unbounded selections and cutout images, ensuring proper handling of source and selection images.
- Improved test coverage for cutout functionalities, including bounds mapping and alpha preservation.
- Updated tests to reflect changes in naming conventions and functionality adjustments.
2026-08-27 12:01:47 +08:00

67 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Depth Plane
Depth Plane 把图片映射为带深度位移的面片,适合快速获得可调节的立体效果。操作方法见[Depth Plane 使用指南](guide-depth-plane.md)。
## 数据流
```mermaid
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.exr` 与 `_color.png` 后缀的 Image datablock
- 使用 `O DA3 Depth Plane` 或 `O MoGe2 Depth Plane` 的 Geometry Nodes 修改器
- 连接颜色、Alpha、Bump 与材质位移的材质
Geometry Nodes 提供深度范围、细分、重拓扑、平滑、背景深度和位移强度等控制。深度 Mask 在几何和材质路径中使用相同阈值,以保持轮廓一致。
材质与图片名称以源 Image datablock 为基名。生成贴图将业务后缀放在真实文件扩展名前,避免 Blender 将其误判为源图数据块。对象 Transform、显示尺寸和 Offset 会转换为面片的空间位置与比例。
## 单图与动画文件
单图深度使用 OpenEXR Pack 到 `.blend`,以保留浮点范围。Packed Image 会先导出临时输入,任务结束后清理,源 Image 保持不变。
动画使用 Job 目录中的外部序列:
```text
<job-id>/
├── image.0001.jpg/png
├── depth.0001.exr
└── results.npz
```
MoGe-2 动画的深度序列使用 `moge_depth.0001.exr`。这些文件是 `.blend` 的运行时依赖,详见[动画与序列帧](animation.md)。
## 适用范围
Depth Plane 是固定平面上的深度位移,不是完整的逐像素 camera-space 重建。它强调可编辑性和动画支持;需要透视网格时使用 [Surface](surface.md)。