Nodes/ComfyUI-SECADNET/SECAD-Net Latent to Mesh
ComfyUI Node

SECAD-Net Latent to Mesh

Fine-tuned latent in, final CAD mesh out

By PozzettiAndrea-archive·Created 9 months ago·Updated 7 months ago· 0
SECAD-Net Latent to Mesh
  • model
  • latent_code
  • mesh
  • status
grid_resolution128
threshold0.50

SECADNetLatentToMesh is the final step of the SECAD-Net pipeline, and it's the node that makes all the fine-tuning worth it. SECADNetInference gives you a rough mesh and the latent code behind it; this node takes a latent code and produces the finished mesh. The difference from Inference is what it skips: no encoder, no voxels, no second guess about what shape you meant. You hand it a latent that's already been optimized for your shape and it just renders.

How it works

It's the second half of the same pipeline, and it shares the same machinery as Inference. The decoder maps the latent code to primitive parameters (quaternions, translations, dimensions for the four sketch-extrude primitives), the neural-sketch-head generator evaluates the occupancy field over a grid_resolution³ grid in 100k-point chunks, and PyMCubes marches cubes through the result at threshold to extract the surface. Vertices get scaled back to the (-0.5, 0.5) unit cube and wrapped in a trimesh object.

The only real difference under the hood is that the encoder never runs - which is exactly why you should feed it the fine-tuned latent. The node's own docstring spells it out: the encoder only provides initialization, and fine-tuning is essential for good results.

Inputs

  • model (SECADNET_MODEL) - from LoadSECADNetModel.
  • latent_code (SECADNET_LATENT) - plug in the optimized_latent from SECADNetFinetune, not the raw one from SECADNetInference. If you feed it the raw latent you'll just get the same rough mesh Inference already gave you, which defeats the whole two-node exercise.
  • grid_resolution (default 128, 64–256) - output sampling density. Higher is finer but slower.
  • threshold (default 0.5) - the marching cubes surface level. Leave it alone unless the mesh is blobby (lower it a touch) or full of holes (raise it).

Outputs: mesh (TRIMESH) and status (STRING) with the vertex/face counts.

Gotchas

The pack ships no mesh preview or exporter, so the TRIMESH output is only useful if you have a consumer node. The included example workflow pairs this pack with ComfyUI-CADabra's GeomPack preview/export nodes - grab a TRIMESH viewer or exporter from there (or anywhere) to actually see and save your result.

Beyond that, this is the least surprising node of the four: if the earlier steps ran, this one just works. If your final mesh is worse than the initial one, the culprit is upstream - your fine-tune overfitted or you wired the raw latent in here. And remember the pack-wide reality check: this is an unfinished, research-grade project with a tiny community footprint, so the source code and the console logs are your best friends when something looks off.

CategoryCADabra/SECAD-Net

Inputs (4)

NameTypeDefaultDescription
modelSECADNET_MODEL
latent_codeSECADNET_LATENT
grid_resolutionoptINT12864–256Output mesh sampling resolution.
thresholdoptFLOAT0.500.1–0.9Marching cubes threshold for surface extraction.

Outputs (2)

NameTypeDescription
meshTRIMESH
statusSTRING