ComfyUI Node

DA3_ToMesh

Turn a Depth Anything 3 depth map into a 3D mesh

By PozzettiAndrea·Created 9 months ago·Updated 2 months ago· 434
DA3_ToMesh
  • depth_raw
  • confidence
  • sky_mask
  • source_image
  • file_path
intrinsics
confidence_threshold0.10
depth_edge_threshold0.10
downsample1
target_faces100000
filename_prefixmesh
allow_around_1false
use_draco_compressionfalse

This is the node that takes a depth map and gives you back an actual 3D file you can open in Blender. Not a parallax trick, not a fake-3D preview - a real mesh, exported to disk, ready to drop into a 3D app. If you've ever wanted to go from a single photo to a printable bas-relief or a chunk of scene geometry, this is the payoff node.

Turning depth into geometry is one of the two things depth estimation has always been good for (the other being ControlNet). Marigold's 3D-printing demo made this famous - image in, watertight STL out, print a bas-relief of your family photo. DA3_ToMesh is the Depth Anything 3 version of that idea, and because DA3 also predicts camera intrinsics, the geometry it reconstructs is better grounded than a naive height-field extrusion.

How it works

It treats the depth map as a height field, unprojects each pixel into 3D using the camera intrinsics, triangulates the result into a surface, and simplifies that surface down to a manageable polygon count. The output is a mesh file on disk, and its path comes back as a string.

Two inputs are required: depth_raw and confidence, both from the DepthAnything_V3 node. Emphasis on raw - set that node's normalization_mode to Raw, not V2-Style. This node validates its input and errors out if it detects normalized depth, because normalized depth makes geometrically wrong meshes. This trips people up constantly, so bank it now: mesh workflows use Raw depth.

The optional inputs that actually matter:

  • sky_mask - connect the sky_mask output from a Mono/Metric/Nested model and sky pixels get excluded. Without it, "sky" reads as a surface at some arbitrary distance and you get a giant warped backdrop welded to your scene. Worth it.
  • confidence_threshold (default 0.1) - drops low-confidence pixels. Raise it if the mesh has junk floating around the edges.
  • depth_edge_threshold (default 0.1) - controls where the mesh gets cut at depth discontinuities. This is what stops your foreground subject from being stretched into the background by a wall of connecting triangles. If your subject looks like it's got taffy pulled between it and the backdrop, lower this.
  • target_faces (default 100000) - the simplification target. Lower it for a lighter file, raise it for more detail. 100k is a sensible middle.
  • downsample (default 1) - process fewer pixels for speed. Bump it if full-res is too heavy.

filename_prefix names the file, use_draco_compression shrinks it (good for web/glTF), and allow_around_1 is a validation escape hatch you shouldn't need.

Output is a single file_path string pointing at the saved mesh. This is an output node, so it writes the file as part of running - you don't need to wire the path anywhere, though you can pass it to another node if you're chaining.

The honest use case

This is bas-relief geometry, not a full 360° model. A depth map only knows the surface facing the camera - there's no data for the back of anything, so you get a single-sided displaced surface, not a closed solid. That's perfect for wall plaques, coins, relief prints, and using as a displacement base you refine elsewhere. It is not going to hand you a game-ready character with a back. For that you'd want a proper multi-view or image-to-3D model; for turning one photo into tangible relief geometry, this is exactly right.

Common issues

The number one problem is the Raw-depth error: if the node refuses to run and complains about normalized input, go back to DepthAnything_V3 and switch normalization_mode to Raw. Second most common is stretched/webbed geometry between foreground and background - that's the depth_edge_threshold, lower it until the discontinuities cut cleanly. Sky forming a giant curved wall behind your subject means you didn't connect a sky_mask (and probably loaded a plain Large model that doesn't make one - swap to Mono or Metric). And if the file is enormous, drop target_faces or turn on Draco compression.

CategoryDepthAnythingV3

Inputs (12)

NameTypeDefaultDescription
depth_rawIMAGE
confidenceIMAGE
intrinsicsoptSTRING
sky_maskoptMASK
source_imageoptIMAGE
confidence_thresholdoptFLOAT0.100–1Filter out vertices with confidence below this threshold
depth_edge_thresholdoptFLOAT0.100.01–1Skip triangles across depth discontinuities (relative threshold)
downsampleoptINT11–16Downsample depth map before meshing (use 1 with target_faces for best quality)
target_facesoptINT1000000–10000000Target face count after decimation (0 = no decimation). Adaptive: keeps detail at edges, simplifies flat areas.
filename_prefixoptSTRINGmesh
allow_around_1optBOOLEANfalseIf your depth values have a max close to 1, you are likely feeding normalized depth instead of real/metric depth. This node requires raw metric depth (typical values 0.1–200+). Disable this check only if your scene truly has max depth ~1 meter.
use_draco_compressionoptBOOLEANfalseUse Draco compression for smaller file size (note: ComfyUI's built-in 3D viewer does not support Draco-compressed meshes)

Outputs (1)

NameTypeDescription
file_pathSTRING