feat: Add surface generation and media handling

- Implemented surface generation functionality in `surface.py`, including geometry estimation and texture writing.
- Introduced media input handling in `input.py`, supporting image and video frame extraction.
- Added model management for geometry adapters in `models/__init__.py`.
- Created BEN2 and DA3 model inference logic in `ben2.py` and `da3.py`, respectively.
- Developed ONNX model inference utilities for BEN2 and DA3 in `onnx_ben2.py` and `onnx_da3.py`.
- Added support for MoGe-2 model inference in `moge2.py` with necessary ONNX utilities.
- Implemented output handling for depth and surface data in `depth.py` and `surface.py`.
- Created debug output utilities for DA3 and MoGe-2 predictions in `debug_da3.py` and `debug_moge2.py`.
- Enhanced ONNX runtime session management in `onnx_runtime.py`.
- Updated `__init__.py` files to include new modules and functions for better organization.
This commit is contained in:
2026-08-18 23:27:10 +08:00
parent 9dfa49602c
commit 835225d264
62 changed files with 2126 additions and 2318 deletions

View File

@@ -106,16 +106,6 @@ def model_enum_items(_owner, _context):
)
def gs_model_enum_items(_owner, _context):
return _model_items(
model
for model in model_catalog()
if model.get("family") == "da3"
and model.get("enabled")
and model.get("supports_gs")
)
def moge2_model_enum_items(_owner, _context):
return _model_items(
model for model in model_catalog() if model.get("family") == "moge2"
@@ -170,11 +160,6 @@ class SnapFormSettings(bpy.types.PropertyGroup):
description="Depth Anything 3 model",
items=model_enum_items,
)
gs_model: bpy.props.EnumProperty(
name="Model",
description="Depth Anything 3 model with a Gaussian head",
items=gs_model_enum_items,
)
device: bpy.props.EnumProperty(
name="Debug Device",
description=(
@@ -221,36 +206,6 @@ class SnapFormSettings(bpy.types.PropertyGroup):
items=moge2_model_enum_items,
default=0,
)
moge_export_format: bpy.props.EnumProperty(
name="Output Format",
description="Additional MoGe-2 debug output generated with results.npz",
items=(
("maps", "Maps", "Export depth, normal, and mask previews"),
("glb", "Textured Surface (GLB)", "Export the official-style textured mesh"),
("ply", "Point Cloud (PLY)", "Export the official-style colored point cloud"),
),
default="maps",
)
conf_thresh_percentile: bpy.props.FloatProperty(
name="Confidence Threshold",
description="Remove the lowest-confidence percentile of points or surface faces",
default=40.0,
min=0.0,
max=100.0,
subtype="PERCENTAGE",
)
num_max_points: bpy.props.IntProperty(
name="Num Max Points",
description="DA3 GLB maximum point count",
default=1_000_000,
min=1,
soft_max=5_000_000,
)
show_cameras: bpy.props.BoolProperty(
name="Show Cameras",
description="Include DA3 camera wireframes in the GLB export",
default=True,
)
ref_view_strategy: bpy.props.EnumProperty(
name="Ref View Strategy",
description="DA3 reference view selection strategy",
@@ -270,56 +225,3 @@ class SnapFormSettings(bpy.types.PropertyGroup):
),
default="saddle_balanced",
)
export_format: bpy.props.EnumProperty(
name="Output Type",
description="Result generated by the DA3 debug task",
items=(
(
"glb",
"Point Cloud (GLB)",
"Generate a colored point cloud and optional cameras",
),
(
"gs_ply",
"Gaussian Splats (PLY)",
"Generate a 3D Gaussian Splatting PLY",
),
(
"depth_vis",
"Depth Preview (Images)",
"Generate image and colored-depth preview pairs",
),
(
"mini_npz",
"Depth Data (NPZ)",
"Generate compact depth, confidence, and camera data",
),
(
"mesh",
"Textured Surface (GLB)",
"Generate one filtered textured depth surface per input image",
),
),
default="glb",
)
mesh_filter_edges: bpy.props.BoolProperty(
name="Filter Depth Edges",
description="Remove faces around sharp depth transitions",
default=True,
)
mesh_max_edge_length: bpy.props.FloatProperty(
name="Max Edge Length",
description=(
"Remove faces with an edge longer than this scene distance; "
"zero disables the test"
),
default=0.1,
min=0.0,
soft_max=2.0,
)
gs_views_interval: bpy.props.IntProperty(
name="GS Views Interval",
description="Export 3D Gaussians every N input views",
default=1,
min=1,
)