Nodes/ComfyUI-Sharp/SHARP Predict (Depth + Gaussian Attrs)
ComfyUI Node

SHARP Predict (Depth + Gaussian Attrs)

The raw gaussian data, before anything gets saved

By PozzettiAndrea·Created 9 months ago·Updated 6 days ago· 361
SHARP Predict (Depth + Gaussian Attrs)
  • model
  • image
  • extrinsics
  • intrinsics
  • mask
  • metric_depth
  • extrinsics_mdepth
  • intrinsics_mdepth
  • first_layer_depth_refined
  • first_layer_gaussian_attrs
  • second_layer_depth_refined
  • second_layer_gaussian_attrs
  • extrinsics
  • intrinsics
focal_length_mm30.0

SharpPredict runs the whole pipeline and writes a .ply in one step. This node is what you reach for when you want to get in between those steps - inspect, mask, or otherwise touch the raw Gaussians before you commit them to a file. It hands back everything SHARP produces except the actual save: depth for both layers, full per-Gaussian attribute tensors for both layers, and the camera matrices - nothing gets written to disk until you pass its output on to SharpImageAttrsToPLY yourself.

How it works

Same two-layer prediction as every other Predict node (visible front surface, hallucinated back surface), but instead of decoding straight to a saved PLY, it exposes each layer's Gaussian attributes as a MULTIBAND_IMAGE - the packed tensor format SharpImageAttrsToPLY expects (position, scale, rotation, color, opacity, all as channels).

The genuinely useful extra here is the optional mask input. Wire in a mask and any pixel under 0.5 has its Gaussian opacity zeroed on both layer outputs - which effectively removes those Gaussians from anything downstream that respects opacity, without you having to touch the tensor data by hand. It auto-resizes to SHARP's 768² Gaussian grid via nearest interpolation, so odd aspect ratios won't error, though the edges of an oddly-shaped mask can come out a little blocky. One deliberate exception: metric_depth is left unmasked even when you use this - the node's own tooltip explains that's intentional, so a downstream LSMR-based depth merge (the kind of thing AlignDepthMaps/ProjectDepthToPanorama do) still has full depth data regardless of what you filtered out of the Gaussians.

The inputs and outputs that matter

  • model / image (required).
  • focal_length_mm (default 30), extrinsics / intrinsics (optional, pass-through and re-emitted - typically from SamplePanorama/SharpPanoramaCubeSplit if you're chaining AlignDepthMaps afterward).
  • mask (optional) - cull Gaussians below 0.5 mask value, as above.

Outputs: metric_depth (unmasked, see above), extrinsics_mdepth / intrinsics_mdepth, first_layer_depth_refined / first_layer_gaussian_attrs, second_layer_depth_refined / second_layer_gaussian_attrs, and a plain extrinsics / intrinsics pass-through.

Installing it

Manager: search "Sharp," install highest (nightly if flaky). Or Manager → Git URL: https://github.com/PozzettiAndrea/ComfyUI-Sharp.git. Manual: clone, pip install -r requirements.txt --upgrade, python install.py, restart.

Common issues

This node is not an output node - nothing gets saved until you route first_layer_gaussian_attrs or second_layer_gaussian_attrs into SharpImageAttrsToPLY. Forget that step and your graph runs cleanly, uses the GPU, produces nothing on disk, and gives you no error - it just looks like nothing happened. That's the workflow working as designed, not a bug, but it trips people who are used to SharpPredict writing a file automatically.

Beyond that, this is a young pack (December 2025), and if you're masking out background Gaussians before a panorama merge, remember the mask only touches the two gaussian-attrs outputs - if you're also relying on metric_depth for alignment further down the pipeline, it's coming through unfiltered by design.

CategorySHARP

Inputs (6)

NameTypeDefaultDescription
modelSHARP_MODEL_CONFIG
imageIMAGE
focal_length_mmoptFLOAT30.00–500Focal length in mm (35mm equiv). 0 = 30mm. Ignored if intrinsics provided.
extrinsicsoptEXTRINSICSPass-through (e.g. from SamplePanorama / SharpPanoramaCubeSplit). Re-emitted on the extrinsics output so downstream nodes (AlignDepthMaps) can wire them.
intrinsicsoptINTRINSICSPass-through. If provided, overrides focal_length_mm. Re-emitted on the intrinsics output.
maskoptMASKOptional per-pixel mask. Pixels with mask < 0.5 have their gaussian opacity set to 0 in both layer attrs outputs — effectively dropping those gaussians from any downstream renderer / PLY exporter that respects opacity. Shape [B, H, W] or [H, W]; auto-resized to the 768² gaussian grid via nearest interpolation. The metric_depth output is left unmasked (useful for downstream LSMR-merge regardless of the gaussian filter).

Outputs (9)

NameTypeDescription
metric_depthIMAGE[B, 1536, 1536, 3] per-pixel metric depth from SHARP's disparity head at NATIVE 1536² resolution (`disparity_factor / monodepth_output.disparity`). Unlike the layer_depth_refined outputs (gaussian z with sub-pixel xy drift), this is a true per-pixel depth map — wire with `extrinsics_mdepth + intrinsics_mdepth` into SharpDepthMerge for a seam-free LSMR merge that matches MoGe2-style smoothness. Memory: 42 faces × 1536² fp32 ~= 395 MB.
extrinsics_mdepthEXTRINSICSPass-through of input extrinsics. Extrinsics are resolution-independent (world-to-camera transform); this is just the same matrix paired with metric_depth so workflows can wire the metric-depth path as a self-contained triplet.
intrinsics_mdepthINTRINSICSIntrinsics rescaled to the 1536² metric_depth grid (pixel-K). Pairs with `metric_depth` so the downstream SharpDepthMerge's K/depth-shape invariant holds without conversion.
first_layer_depth_refinedIMAGE[B, H, W, 3] depth broadcast across 3 channels. Layer-0 (visible surface) post-decoder z. NOTE: this is the gaussian's z position; the gaussian's xy may have drifted from the source pixel grid. Use `metric_depth` instead for clean per-pixel depth.
first_layer_gaussian_attrsMULTIBAND_IMAGE[B, 14, H, W] all layer-0 gaussian attributes. Channels: position_xyz, scale_xyz, quat_wxyz, color_rgb, opacity.
second_layer_depth_refinedIMAGE[B, H, W, 3] layer-1 (back/occluded surface) post-decoder z.
second_layer_gaussian_attrsMULTIBAND_IMAGE[B, 14, H, W] all layer-1 gaussian attributes.
extrinsicsEXTRINSICS
intrinsicsINTRINSICS