mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #232] [MERGED] Add 3D mesh operations for remeshing (CORE-560) #241
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#241
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/232
Author: @kijai
Created: 10/5/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @comfyanonymous
Base:
main← Head:mesh-ops📝 Commits (6)
b443aabAdd delaunay3d, mesh_bvh, connected_components, edge_collapse_checks and min_cut CUDA ops172365bFix unused unpacked variables in test_delaunay3d0fcdd3cDrop numpy from test_edge_collapse2166482Fixes for reviewerf07199fSmall fix0359264Validate shapes, device and cutoff in mesh BVH and Delaunay ops📊 Changes
15 files changed (+2677 additions, -0 deletions)
View changed files
📝
README.md(+6 -0)📝
comfy_kitchen/__init__.py(+97 -0)📝
comfy_kitchen/backends/cuda/CMakeLists.txt(+5 -0)📝
comfy_kitchen/backends/cuda/__init__.py(+360 -0)📝
comfy_kitchen/backends/cuda/dlpack_bindings.cpp(+223 -0)➕
comfy_kitchen/backends/cuda/ops/connected_components.cu(+90 -0)➕
comfy_kitchen/backends/cuda/ops/delaunay3d.cu(+562 -0)➕
comfy_kitchen/backends/cuda/ops/edge_collapse.cu(+154 -0)➕
comfy_kitchen/backends/cuda/ops/mesh_bvh.cu(+278 -0)➕
comfy_kitchen/backends/cuda/ops/min_cut.cu(+230 -0)➕
tests/test_connected_components.py(+73 -0)➕
tests/test_delaunay3d.py(+128 -0)➕
tests/test_edge_collapse.py(+165 -0)➕
tests/test_mesh_bvh.py(+134 -0)➕
tests/test_min_cut.py(+172 -0)📄 Description
Add CUDA geometry ops for mesh processing
ComfyUI's mesh post-processing (solid remesh, decimation, repair) needs a few geometry primitives on the GPU.
On a 1536-grid remesh, scipy's Delaunay takes 37 s and a torch push-relabel 18 s, versus 0.3 s and 0.5 s with these kernels.
Five CUDA-only ops in plain CUDA C++
delaunay3d(points)— gDel3D-style parallel insertion + 2-3/3-2 flips; the boundingtet's vertices are kept so callers can tell outside tets; float64 orientation predicates
with a double-double fallback.
mesh_bvh(tris)/closest_point_on_mesh(bvh, points, max_dist)— Karras LBVH, exactclosest point; distance, point and face per query.
connected_components(edges, n)— ECL-CC lock-free union-find, min-index labels.edge_collapse_checks(vertices, faces, edges, positions, cos_threshold)— flip / skinny /link-condition checks per candidate collapse over an in-kernel CSR fan; deterministic.
min_cut(nbr, cap, s_cap, t_cap)— push-relabel min s-t cut on bounded-degree graphswithout float atomics (thread-order independent); returns the maximal source side.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.