Nodes/ComfyUI-RealProductScene/Composite Product Scene
ComfyUI Node

Composite Product Scene

The node that drops your real product onto the generated background — no AI redraw

By yorimi-tamai·Created 2 months ago·Updated 2 months ago· 1
Composite Product Scene
  • background
  • product_image
  • product_mask
  • image
shadow_dirright
surface_line_frac0.78
target_width_frac0.60
target_height_frac0.42
scale_mult1.00
offset_x0
offset_y0
shadow_opacity0.30
shadow_blur8
shadow_offset_y0

This is the payoff node of the ComfyUI-RealProductScene pack. By the time you reach it, you've already generated an empty 9:16 background (lit to match your product, thanks to AnalyzeProductLighting) and you're holding a clean cutout PNG of the real product. CompositeProductScene is where the two finally meet: it pastes your product onto the background, bakes in a believable contact shadow, and hands you a final frame ready for image-to-video. The guarantee that makes the pack worth using - product pixels 100% from the original, logo, text, proportions intact - is enforced right here.

How it works

Grounded in the source, the node does three things in sequence. First it rebuilds your product as RGBA from the IMAGE + MASK pair and tight-crops it to the alpha bounding box, trimming away dead transparent space. Second, it computes placement geometry: how big the product should be (target_width_frac × target_height_frac of the frame), where its bottom edge should sit (surface_line_frac, the contact line with the tabletop), plus your scale and offset nudges. Third comes the pasting, in a deliberate order that sells the illusion:

  1. a soft, blurred spread shadow under the product,
  2. a tighter, darker contact core right at the base,
  3. the product itself on top, using its alpha.

The two-layer shadow is the part most people underrate. A single soft blob reads as "floating in fog"; the tight core is what grounds the object on the surface. shadow_dir (left / right / none) tells it which way the shadow falls, and it's designed to come straight from AnalyzeProductLighting's output - that's the whole point of wiring the two together.

The inputs that matter

  • background - the empty scene. Classic trap: if your background already contains a product, you get two products. The generation half of the pack is explicitly prompted to keep the surface clear.
  • product_image + product_mask - same rule as its sibling: real transparency required, or it errors out. No auto-cutout here.
  • surface_line_frac (default 0.78) - where the product's bottom meets the tabletop, as a fraction down the frame. This is the first knob you'll touch.
  • target_width_frac / target_height_frac - how much of the frame the product occupies. Defaults of 0.6 × 0.42 read nicely for a hero shot.
  • scale_mult, offset_x, offset_y - the fine-tune nudges for when auto placement is 80% right and you need the last 20%.
  • shadow_opacity / shadow_blur / shadow_offset_y - the shadow tuning. If the composite looks pasted, this is where you fix it.

The output is a single image - wire it to SaveImage, or drop it straight into your image-to-video workflow as the starting frame, which is literally what the pack was built for: a stable 9:16 product shot ready to animate.

Install

Same pack, same steps as AnalyzeProductLighting - one install gets you both, under the product-scene category. Via ComfyUI Manager search "ComfyUI-RealProductScene", or:

cd ComfyUI/custom_nodes
git clone https://github.com/yorimi-tamai/ComfyUI-RealProductScene.git
pip install -r ComfyUI-RealProductScene/requirements.txt
# restart ComfyUI

Dependencies are light: Pillow (usually already in ComfyUI) and opencv-python, which is only used by the CLI's swap backend, not by this node. Crucially, this node requires no model at all - it's pure image processing. The heavy model downloads (the z-image-turbo stack the example workflow uses to generate the background) are separate and optional if you bring your own background.

Troubleshooting

The most common "why does it look fake" causes, in order: the product's bottom isn't meeting the table - raise surface_line_frac (or lower offset_y to nudge it down); the shadow is too weak or too hard - push shadow_opacity toward 0.4–0.5 and shadow_blur up, and try a small positive shadow_offset_y to let the shadow spill forward; the product dominates the frame - drop target_width_frac. And if the shadow direction feels wrong, remember shadow_dir is just a string - you can override it on the widget even when it's wired from the analyze node. One honest caveat: this is deterministic compositing, not magic. A product shot with wildly unflattering lighting won't be rescued by a shadow layer; it'll just be a well-composited image of a badly-lit product. Fix the source, and this node will reward you.

Categoryproduct-scene

Inputs (13)

NameTypeDefaultDescription
backgroundIMAGE
product_imageIMAGE
product_maskMASK
shadow_dirSTRINGright
surface_line_fracFLOAT0.780–1
target_width_fracFLOAT0.600.05–1
target_height_fracFLOAT0.420.05–1
scale_multFLOAT1.000.1–3
offset_xINT0-2048–2048
offset_yINT0-2048–2048
shadow_opacityFLOAT0.300–1
shadow_blurINT80–64
shadow_offset_yINT0-512–512

Outputs (1)

NameTypeDescription
imageIMAGE