Nodes/ComfyUI-NKD-VFX-Tools/😺NKD Preview 3D
ComfyUI Node

😺NKD Preview 3D

Block the Shot in 3D, Hand the Render to the Graph

By Nekodificador·Created 6 months ago·Updated a day ago· 155
😺NKD Preview 3D
  • model_file
  • camera_info
  • bg_image
  • model_3d_info
  • scene_depth
  • image
  • object
  • mask
  • depth
  • camera_info
â—„scene_depth_invertfalseâ–º
â—„scene_depth_near1.0â–º
â—„scene_depth_far30.0â–º
â—„scene_depth_spaceinverse (disparity)â–º
â—„width1024â–º
â—„height1024â–º
â—„viewportâ–º

Preview 3D is the heart of this pack, and the reason the whole thing exists. The idea: instead of asking a diffusion model to place an object in a scene by guessing, you block the shot - put the object where you want it in 3D, against the real photo, with the real camera - and then hand the model the control maps that already say where everything goes. This node is a 3D viewport that exports what it renders, so the result isn't a dead-end preview but a full set of inputs for the rest of the graph.

How it works

The render happens in the browser via WebGL (three.js for meshes, Spark for gaussian splats), and the capture is taken client-side and uploaded back into the graph. The coordinate convention matches ComfyUI core exactly - right-handed, Y-up, camera looking down -Z - so the camera_info it emits interoperates with NKD fSpy Camera, core's Load3D, and the rest of the pack. Models from image-to-3D tools usually arrive without proper surface normals and look like bags of flat facets; Preview 3D smooths them on load (including across UV seams) unless you turn that off for the faceted look.

What you can feed it

model_file accepts a lot for one input: a GLB/GLTF path, a MESH straight from a mesh-building node (Convert MoGe Point Map to Mesh, Convert DA3 Geometry to Mesh), a TRIMESH out of the Hunyuan3D wrapper, or a gaussian splat (.ply, .spz, .splat, .ksplat). It also accepts a plain path under your input or output folder.

The optional inputs are where it gets good. camera_info from fSpy Camera puts the model in the photo's real perspective. bg_image is the backdrop photo itself, shown behind the model and composited into the export. scene_depth is the backdrop's depth map (Depth Anything, Marigold) - it becomes the base layer of the depth output, so the model reads as sitting in the scene rather than pasted on it. The three scene_depth_* widgets (invert, near, far, space) tie that depth map to real scene distance; monocular estimators emit inverse/disparity depth, which is the default.

What comes out

  • image - the full composite, model over backdrop. Your img2img base.
  • object - the model alone on RGBA with straight alpha, for compositing.
  • mask - the model's silhouette, ready to drive an inpaint.
  • depth - the render's depth, matched to the scene's depth map. Your ControlNet depth channel.
  • camera_info - the viewport camera, to drive other 3D nodes (and NKD Camera Delta Prompt).

The viewport pops out to a full-size viewer, gizmos answer to Q/W/E/R while the pointer's over the viewport, and the Depth tab shows the actual exported depth live so you dial near/far against what you see instead of re-queueing to find out.

Install and gotchas

Same as the pack: ComfyUI Manager, search "NKD VFX Tools", restart. It ships no models - the depth, mesh and splat generators all come from your other installed packs. One honest quirk: because the capture happens client-side before execution, the first run after wiring a link (width/height) can't know the linked value yet and uses the widget's own. Nothing reloads when you close the popped-out viewer; it's the same live scene. If you already wrestled with ComfyUI-3D-Pack's CUDA builds, note what this isn't: no compiled extensions here, which is exactly why it's the pleasant way to move a model into a shot.

Category😺NKD Nodes/3D

Inputs (12)

NameTypeDefaultDescription
model_fileSTRING,MESH,TRIMESH,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLATA 3D model (GLB/GLTF), a MESH straight from a mesh-building node (MoGe, DA3...), a TRIMESH (Hunyuan3D wrapper), a gaussian splat (.ply/.spz/.splat/.ksplat) from an upstream node, or a path under the input or output folder.
scene_depth_invertBOOLEANfalseOn if your depth map reads far as white. This node's own depth output, and most disparity maps, read near as white.
scene_depth_nearFLOAT1.00.01–1000Scene distance the map's nearest value stands for. A depth map has no scale of its own, so these two numbers are what tie it to the 3D scene — tune them until the model sits at the right depth.
scene_depth_farFLOAT30.00.02–10000Scene distance the map's farthest value stands for.
scene_depth_spaceCOMBOinverse (disparity)How the map's greys relate to distance. Monocular estimators (Depth Anything, MiDaS...) emit INVERSE depth: grey falls off fast near the camera, slowly far away. The object's exported grey follows the same curve, so its tone matches the scene's at the same distance. Pick linear only for metric z maps.
widthINT10241–8192—
heightINT10241–8192—
viewportSTRING—
camera_infooptLOAD3D_CAMERASolved camera, e.g. from 😺NKD fSpy Camera.
bg_imageoptIMAGEBackdrop photo, shown behind the model and composited into the exported image.
model_3d_infooptLOAD3D_MODEL_INFOPosition/rotation/scale to place the model.
scene_depthoptIMAGEDepth of the backdrop photo (Depth Anything, Marigold...). Composited into the depth output as its base layer, so the model reads as sitting in the scene. Never clips the render. Must line up with bg_image.

Outputs (5)

NameTypeDescription
imageIMAGEThe full composite: model over the backdrop.
objectIMAGEThe model alone, RGBA with straight alpha, for compositing.
maskMASKThe model's silhouette, white — ready to drive an inpaint.
depthIMAGEDepth, near white to far black. The model's depth composited over the scene's depth map (when one is connected).
camera_infoLOAD3D_CAMERA—