Nodes/ComfyUI-Sharp/SHARP Predict Foreground (Image to PLY)
ComfyUI Node

SHARP Predict Foreground (Image to PLY)

One clean gaussian layer instead of two

By PozzettiAndrea·Created 8 months ago·Updated 2 months ago· 358
SHARP Predict Foreground (Image to PLY)
  • model
  • image
  • extrinsics
  • intrinsics
  • ply_path
  • extrinsics
  • intrinsics
modeclosest
focal_length_mm30.0
output_prefixsharp_fg

SharpPredict gives you two Gaussian layers per pixel - a front surface plus a hallucinated "what's behind it" layer, which roughly doubles your point count and buys you occlusion fill-in for a proper walkable scene. This node exists for when you don't want that trade: a clean subject cutout, a product shot, dropping something into an existing 3D scene where you only care about the surface facing the camera. It's the same underlying prediction, collapsed down to one Gaussian per pixel before saving.

How it works

The mode parameter decides how the two layers get reduced to one, and it's a real trade-off, not just a speed knob:

  • closest (default) - for each pixel, keep whichever of the two Gaussians actually has the smaller depth. This is the robust choice: SHARP's decoder occasionally swaps which layer is "in front" for a given pixel, and closest finds the true front surface regardless of which layer it landed in.
  • slice - always keep layer 0, no comparison. Faster, but if the decoder swapped layers for a pixel, you can end up with a stray back-layer Gaussian sitting where you expected the front surface.

Stick with closest unless you've profiled the difference and genuinely need the speed.

The inputs and outputs that matter

  • model / image (required) - same as every Predict node.
  • mode (required, default closest) - see above.
  • focal_length_mm (default 30, 0 = auto), extrinsics / intrinsics - identical semantics to SharpPredict: get focal length from LoadImageWithExif for real photos, or wire real camera matrices from SamplePanorama if you're in a multi-view pipeline (intrinsics overrides focal_length_mm entirely).
  • output_prefix (default sharp_fg).

Outputs: ply_path, extrinsics, intrinsics - that's it. No depth-layer image outputs here, unlike SharpPredict, which makes sense once you realize there's only one surface left to show.

Installing it

Same pack, same steps: Manager search "Sharp" (install highest, try nightly if it fails), Manager → Git URL, or manual clone + pip install -r requirements.txt --upgrade + python install.py, restart. Model weights auto-download on first run into ComfyUI/models/sharp/.

To actually view the resulting point cloud inside ComfyUI you need ComfyUI-GeometryPack installed separately - its PreviewGaussian node isn't part of this pack. Missing that node is the single most common "why doesn't this work" moment on release, per the pack's own launch thread.

Common issues

Same baseline gotchas as SharpPredict, since it's the same model underneath: a blank or textureless-white preview has been reported specifically on Apple Silicon (the file itself is usually fine - check it in superspl.at/editor before assuming something's broken), and 8GB VRAM cards have reported both outright OOMs and silent hangs.

The one thing specific to this node: whichever layer you drop is gone for good. If you later decide you need the back/occlusion layer after all - say you want to fill in gaps for a wider parallax move - you can't recover it from this node's output. Reach for SharpPredict instead if there's any chance you'll want both layers, and only commit to SharpPredictForeground once you're sure a single clean surface is actually what the downstream use case needs.

CategorySHARP

Inputs (7)

NameTypeDefaultDescription
modelSHARP_MODEL_CONFIG
imageIMAGE
modeCOMBOclosestHow to reduce SHARP's 2-layer gaussian output to 1 per pixel. closest: pick the gaussian with smaller z per pixel (guaranteed front surface — robust to decoder layer swaps). slice: keep layer 0 only (first H·W gaussians); faster but misses pixels where the gaussian decoder swapped layers.
focal_length_mmoptFLOAT30.00–500Focal length in mm (35mm equiv). 0 = auto (30mm). Ignored if intrinsics provided.
output_prefixoptSTRINGsharp_fgPrefix for output PLY filename or batch folder.
extrinsicsoptEXTRINSICSCamera extrinsics (from SamplePanorama). If batched, must match image batch size.
intrinsicsoptINTRINSICSCamera intrinsics. Overrides focal_length_mm.

Outputs (3)

NameTypeDescription
ply_pathSTRING
extrinsicsEXTRINSICS
intrinsicsINTRINSICS