Files
AnyImage/docs/internals/operators/cutout-tool.md
nan 4c902ed7db feat(node_assets): add image plane geometry nodes and validation scripts
- Implemented `image_plane.py` to build the Image Plane Geometry Nodes group with customizable parameters for geometry, subdivide, and thickness.
- Created `image_plane_validation.py` to validate the functionality of the image plane, ensuring correct geometry generation and material assignment.
- Developed `material_layers.py` to construct shader node groups for image materials, including depth and normal handling.
- Authored `plane_layouts.py` to define node arrangements for image geometry assets.
- Introduced `shadeless.py` to create a shadeless shader node group that displays color without scene lighting while preserving shadows and reflections.
2026-09-08 23:24:27 +08:00

2.3 KiB
Raw Blame History

Cutout

Cutout 在静态 Image Empty 上圈定 Selection,按轮廓创建 Flat、Solid、Depth Solid 或 Depth Balloon。入口位于 operators/cutout_tool/main.py,菜单与采样级别映射位于 interaction.py,标识和资产对应关系位于 shape.py。

flowchart TD
    A[Lasso 拖动并提交 SelectionPath] --> B[选择 Shape]
    B --> C[栅格化 SelectionMask 并读取源 RGBA]
    C --> D{需要 Depth 或 Normal?}
    D -- 是 --> E[准备 bounds 矩形 RGBA]
    E --> F[generate-cutout-artifacts]
    F --> G[加载 Depth、Metadata 与 Normal]
    G --> H[源 Alpha 与 SelectionMask 组合]
    D -- 否 --> H
    H --> I[轮廓、采样、约束三角化与 o_balloon]
    I --> J[BaseShape]
    J --> K[创建材质、对象与对应节点修改器]
预设 节点组 AI 产物
Flat O Image Cutout,Thickness 0 可选 Tangent Normal
Solid O Image Cutout,Thickness 1 可选 Tangent Normal
Depth Solid O Image Depth Cutout Depth 与 Object Normal
Depth Balloon O Image Depth Balloon Depth 与 Tangent Normal

轮廓与网格

geometry.py 从内容 Alpha 提取连通轮廓和孔洞,按 Mesh Detail 采样并生成 BaseShape。Low、Medium、High、Ultra 分别以 32、16、8、4 个源像素作为基础间距,并受 Maximum Cutout Mesh Resolution 限制。

fine_mesh.py 负责 Fine Outline 的细节保留与约束网格,polygon.py 提供轮廓运算。Balloon Profile 按 Preferences 选择 Poisson 或 Teddy,生成所有预设共用的 POINT 属性 o_balloon。

AI 与对象创建

Server 接收 Selection bounds 内保留源 Alpha 的 RGBA,一次 MoGe-2 推理按 generate_depth 与 normal_mode 返回产物。深度边缘延展使用所选 Alpha Threshold,Normal 使用原预测;AI 输入上限只影响分析分辨率。

object.py 的 create_shape_object() 消费 BaseShape、Color、Depth 和 Normal,加载对应节点组。基础网格位于局部 XY,向图片内部为 -Z;选择 +X 时节点与对象矩阵配对变换,保持世界几何一致。Object Normal 同步按方向转换。

材质使用 IOR 1.2,颜色进入 Image Layer,o_normal_scale 控制法线影响。Depth Solid 使用正面 FACE 标记,其他适用预设使用轮廓权重。节点计算见节点资产。