Add geometry nodes asset and validation script

- Implemented a new geometry nodes asset in `build_geometry_nodes_asset.py` to handle mesh refinement and topology fixing.
- Created a validation script in `validate_geometry_nodes_asset.py` to ensure the integrity and functionality of the geometry node group.
- Added input handling for various parameters including resolution, iterations, and smoothing options.
- Included checks for node group structure and attributes to validate the geometry processing pipeline.
This commit is contained in:
2026-08-11 13:23:13 +08:00
parent fc27c23fd1
commit 07d836d9ad
15 changed files with 2408 additions and 68 deletions

View File

@@ -5,6 +5,7 @@ SnapForm 是一个 Blender 扩展,可以把一张照片、一段视频或一
## 它能做什么
- 一键把 Image Empty 转换为立体面片:让 AI 估算深度,或直接用原图作为深度
- 把单张 Image Empty 转换为透视纹理网格,并自动匹配原对象的 Transform 与 Offset
- 一键去除图片背景,生成透明前景图
- 支持视频与序列帧输入,逐帧处理,动画也能得到逐帧对应的立体面片
- 全部操作都在右键菜单里完成,不需要写任何代码
@@ -27,7 +28,7 @@ DA3、BEN2 源码包和 uv 已内置在扩展里,安装时直接从本地解
### 转换为立体面片
1. 在 3D 视图中选中一个 Image Empty(空物体,显示方式为 Image)
2. 右键选择 `Convert to Depth Plane`
2. 右键打开 `SnapForm` 子菜单,选择 `Convert to Depth Plane`
3. 在对话框中选择:
- `Depth from`:`Original` 直接用原图,`AI Generated` 让 AI 估算深度
- `Background Depth Distance` 为 `0` 时不剔除背景;大于 `0` 时把背景设为固定距离,AI 与 Original 均支持
@@ -36,7 +37,21 @@ DA3、BEN2 源码包和 uv 已内置在扩展里,安装时直接从本地解
### 去除背景
选中 Image Empty 后,右键选择 `Remove Background`,完成后 Empty 会自动换成透明前景图。
选中 Image Empty 后,右键打开 `SnapForm` 子菜单并选择 `Remove Background`,完成后 Empty 会自动
换成透明前景图。该操作在子菜单中使用独立分割区域。
### 转换为透视网格
选中单张图片的 Image Empty,右键打开 `SnapForm` 子菜单并选择 `Convert to Mesh`。SnapForm 会按 DA3
相机内参与深度逐像素反投影,并把生成网格匹配到原 Empty 的可见尺寸、Offset 与 Transform。DA3
confidence、边拉伸与 BEN2 背景结果会保存为 Mesh attributes,再由一个可复用的 Geometry Nodes
修改器完成剔面、快速重拓扑、Relax 与 UV 重投。匹配相机默认不创建;开启后会作为 Mesh 的子级。
当前此功能仅支持单张图片。
转换对话框只保留模型设置、`Create Matching Camera`、`Unshaded` 与 `Delete Original`。剔除和重拓扑参数直接在
Geometry Nodes 修改器中调整;`Unshaded` 可使用与 Depth Plane 相同的 Emission 材质。普通材质的
Bump Distance 会按透视网格的深度空间缩放。Mesh attributes 统一使用 `o_` 前缀;Host 准备过程显示
`Post-processing n/6`,可看到当前阶段与总步骤。
### 视频与序列帧