Files
fn_registry/python/functions/pipelines/comfyui_mesh_cleanup_oneshot.md
T
egutierrez f686b338d6 chore: auto-commit (14 archivos)
- docs/capabilities/comfyui.md
- python/functions/ml/comfyui_build_image_to_3d_workflow.md
- python/functions/ml/comfyui_build_image_to_3d_workflow.py
- python/functions/ml/tests/test_comfyui_build_image_to_3d_workflow.py
- python/functions/ml/comfyui_build_facedetailer_workflow.md
- python/functions/ml/comfyui_build_facedetailer_workflow.py
- python/functions/ml/comfyui_build_hires_fix_workflow.md
- python/functions/ml/comfyui_build_hires_fix_workflow.py
- python/functions/ml/tests/test_comfyui_build_facedetailer_workflow.py
- python/functions/ml/tests/test_comfyui_build_hires_fix_workflow.py
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-24 02:34:10 +02:00

4.5 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
comfyui_mesh_cleanup_oneshot pipeline py pipelines 1.0.0 impure def comfyui_mesh_cleanup_oneshot(in_path: str, *, target_faces: int = 80000, watertight: bool = True, method: str = "repair", out_path: str | None = None) -> dict Pipeline de limpieza de mallas 3D en una sola llamada: decima a un presupuesto de caras (comfyui_simplify_mesh) y, opcionalmente, la hace estanca (comfyui_make_watertight). Capitaliza el 'Golden 3' del report 0088 (80k caras + estanca a la vez) para las mallas densas no estancas que produce el pipeline Hunyuan3D de ComfyUI. Promocion de secuencia (issue 0087). Impuro: lee y escribe archivos en disco; requiere trimesh + pymeshlab + scipy.
comfyui
pipelines
mesh
cleanup
watertight
launcher
comfyui_simplify_mesh_py_ml
comfyui_make_watertight_py_ml
false error_py_core
comfyui_simplify_mesh_py_ml
comfyui_make_watertight_py_ml
name desc
in_path Ruta de la malla de entrada (.glb/.obj/.ply/.gltf/.stl/.off).
name desc
target_faces Caras objetivo del paso de decimacion (comfyui_simplify_mesh). keyword-only.
name desc
watertight Si True (default) aplica comfyui_make_watertight tras decimar; si False solo decima. keyword-only.
name desc
method Metodo de make_watertight cuando watertight=True. 'repair' (default) conserva las caras decimadas pero no garantiza estanqueidad en mallas muy rotas; 'voxel' garantiza is_watertight=True via voxeliza+fill+marching cubes, a costa de re-mallar (cambia el conteo de caras y descarta apariencia). keyword-only.
name desc
out_path Ruta de salida final. Si None, se deriva de in_path ('<in>_cleaned.glb'). keyword-only.
dict {ok, in_path, out_path, in_faces, simplified_faces, final_faces, watertight_requested, is_watertight, method, steps, error}. steps = resultados crudos de cada funcion compuesta. Si algun paso falla, ok=False y error explica en cual. false
python/functions/pipelines/comfyui_mesh_cleanup_oneshot.py

Ejemplo

# Limpia la malla densa de ComfyUI: decima a 80k caras y la hace estanca.
./fn run comfyui_mesh_cleanup_oneshot ~/ComfyUI/output/3d_mesh_00002_.glb
import sys, os
sys.path.insert(0, os.path.join(os.environ["HOME"], "fn_registry", "python", "functions"))
from pipelines.comfyui_mesh_cleanup_oneshot import comfyui_mesh_cleanup_oneshot

res = comfyui_mesh_cleanup_oneshot(
    os.path.expanduser("~/ComfyUI/output/3d_mesh_00002_.glb"),
    target_faces=80000,
    watertight=True,
)
# res["ok"] == True
# res["in_faces"]  >> res["final_faces"]   # decimada
# res["is_watertight"]  # True/False segun method y la malla
print(res["in_faces"], "->", res["final_faces"], "watertight:", res["is_watertight"])

Cuando usarla

Justo después de generar una malla 3D con ComfyUI/Hunyuan3D (comfyui_image_to_3d_oneshot, comfyui_text_to_3d_oneshot), cuando el GLB sale denso (decenas de MB, >1M caras) y/o no estanco. En una llamada la dejas lista para web (ligera) o impresión 3D (cerrada). Es la promoción del patrón "simplify → make_watertight" que se repetía a mano (reports 0088/0091).

Gotchas

  • Impuro: lee y escribe archivos en disco. Con watertight=True deja también un intermedio <out>_simplified.glb junto al final.
  • Necesita trimesh + pymeshlab + scipy (decimación). Con method="voxel" además scikit-image (marching cubes). Si falta una, el paso correspondiente devuelve ok=False con el comando uv add a ejecutar.
  • method="repair" (default) NO garantiza estanqueidad en mallas muy rotas: cierra huecos pequeños y conserva las caras decimadas. El output reporta is_watertight real — compruébalo. Si necesitas estanqueidad GARANTIZADA usa method="voxel" (re-malla: cambia el conteo de caras y descarta UV/colores).
  • El target_faces aplica al paso de decimación. Con method="voxel" el conteo final lo fija el voxel-remesh (mira final_faces), no target_faces.
  • El pipeline NO falla si la malla no queda estanca con repair: devuelve ok=True con is_watertight=False. Decide en el caller si reintentar con method="voxel".
  • No toca el servidor ComfyUI: opera sobre archivos GLB ya en disco.

Capability growth log

  • v1.0.0 (2026-06-24) — pipeline inicial. Compone comfyui_simplify_mesh + comfyui_make_watertight (issue 0087, capitaliza report 0088).