Advanced workflow · 10 min read
Two-Pass Product Compositing: Scene Integration and the Final Hero Shot

A product can be technically present in an image and still look pasted on. The reliable fix is to separate scene integration from hero-detail refinement: first establish believable placement, light, and scale; then spend compute on the final product surface.
The core idea is simple: do not ask one generation to solve layout, lighting, object identity, material detail, and output resolution at the same time. In ComfyUI, build two related branches instead. Pass one produces a convincing scene-level composite at a manageable resolution. Pass two uses that approved composition as a constraint while refining the product area and the final hero shot.
This workflow is useful when the product must remain recognizable—packaging, a bottle, a device, or a small appliance—but the surrounding environment is synthetic or substantially altered. It is also easier to debug: if the product is in the wrong place, inspect pass one; if the placement works but the label is soft, inspect pass two.
The working model
Think of the image as three layers of responsibility:
- Scene: camera angle, horizon, background, surface, and broad light direction.
- Product: silhouette, proportions, branding, material response, and contact with the surface.
- Finish: local sharpness, reflections, small shadows, and output-size detail.
Pass one owns the first two layers at low or medium resolution. Pass two owns the third layer and corrects only what the approved composition requires. The separation reduces accidental reframing and makes it possible to iterate on atmosphere without repeatedly destroying product detail.
Concrete case: a tabletop product image
Use this example as a test scenario, not as a verified benchmark. The input is a front-facing product photograph with a clean background. The target is a warm tabletop scene: the product sits slightly right of center, a soft window light comes from the upper left, and the background falls away into muted beige and green.
The desired output is not a new product design. The product should retain its silhouette and label hierarchy while the scene gains believable perspective, contact shadow, and color temperature. That distinction determines the strength of the generative operations.
Pass one: solve integration before detail
1. Prepare the source and the composition guide
Start with a product image that has enough margin around the object to support cropping. Remove or mask the original background if it conflicts with the target scene. Create a simple composition guide containing:
- the intended product bounding box;
- the tabletop or ground line;
- the main light direction;
- the approximate vanishing direction, if the scene has strong perspective.
A rough guide is usually more useful than a detailed painted background. The goal is to communicate structure, not to pre-render every texture.
2. Encode pose and structure
Use a ControlNet or equivalent structural conditioning branch when the product must stay aligned to a reference pose. A depth or line-based guide can stabilize the scene geometry; an edge guide can protect the silhouette. Use the weakest control strength that preserves the required structure.
For the product region, use a generous mask rather than tracing every pixel. A narrow mask can create a visible seam and may prevent the model from generating a natural contact shadow. Keep a few pixels of surrounding surface inside the mask so the transition can be relit.
3. Use moderate denoising
Pass one can be implemented as img2img or masked inpainting. Moderate denoising gives the model room to reconcile the product with the scene without fully discarding the source.
{
"pass": "integration",
"resolution": "1024x1024 or the closest practical equivalent",
"steps": 28,
"cfg": 5.5,
"denoise": 0.42,
"sampler": "a stable sampler available in the installation",
"seed": 184729,
"control_strength": 0.65,
"mask_padding": "small-to-moderate"
}
The values are an example configuration, not a measured result. The seed is useful because it makes comparisons meaningful while you adjust one variable at a time. If the product changes identity, reduce denoise or increase reference conditioning before increasing prompt detail.
4. Prompt for relationships, not adjectives
A useful pass-one prompt describes how objects relate to one another:
premium product on a matte stone tabletop,
three-quarter camera angle,
product placed slightly right of center,
soft window light from upper left,
subtle contact shadow beneath the product,
warm neutral interior, muted green background,
natural perspective, realistic scale, commercial product photography
Negative prompting should target failure modes that matter for the scene: floating object, incorrect scale, duplicated product, warped silhouette, unreadable geometry, harsh outline, and inconsistent light direction. Avoid a long list of generic quality terms that does not address the actual error.
5. Select the composition before upscaling
Generate a small batch with the same seed family or with deliberately varied seeds. Select the frame whose camera, object scale, and light direction are correct. Do not select based only on label sharpness; that is pass two’s job.
At this checkpoint, verify:
- the product rests on the surface instead of floating;
- the cast shadow agrees with the stated light direction;
- the product occupies the intended fraction of the frame;
- the background does not compete with the product silhouette;
- the visible side faces have plausible perspective.
Pass two: refine the approved hero frame
1. Freeze the scene decisions
Save the selected pass-one image and its metadata. In the second branch, avoid changing the canvas aspect ratio, product bounding box, or global prompt unless the first pass contains a clear defect. This is the point where many workflows lose control: an “upscale” quietly becomes another composition pass.
2. Use a local detail mask
Create a product-focused mask that covers the label, cap, screen, controls, or other identity-bearing areas. Feather the mask into the surrounding product and surface. Keep a separate, wider mask for contact shadow and reflection corrections if the workflow supports it.
For a local latent refinement, use lower denoise than in pass one:
{
"pass": "hero-detail",
"input": "approved pass-one image",
"target": "2x output or the final delivery size",
"steps": 32,
"cfg": 4.5,
"denoise": 0.18,
"detail_mask": "product identity areas",
"scene_mask": "disabled unless correcting contact or reflection",
"seed": 184729
}
Again, these are starting values. Lower denoise generally protects the approved image more strongly, but it can also preserve defects. If the label is still soft, enlarge the masked area or make a small denoise increase rather than rerunning the entire frame at high strength.
3. Protect identity with references
If your workflow uses a reference adapter, image prompt, or LoRA, apply it mainly where identity matters. A strong reference can preserve the product but may flatten the scene integration. A weak reference can allow more natural lighting but may alter logos, buttons, or proportions. Test these as separate branches so the trade-off remains visible.
Do not use text alone to restore a specific logo or label. Text conditioning can describe intent, but it is not a reliable substitute for a clean visual reference. For regulated, transactional, or brand-critical artwork, manually verify the final product surface in an image editor or design tool.
4. Recombine with the original scene
When the second pass improves the product but changes the background, composite only the approved product region back over the pass-one scene. A soft edge and a small amount of scene-colored spill can make the merge more convincing than a hard cutout.
Inspect the seam at 100% and at the intended display size. A seam that is invisible when zoomed in may still read as a halo in a thumbnail; a tiny texture mismatch that looks alarming at 400% may be irrelevant in the final image.
Verification checklist
No universal visual test can guarantee realism, so verification should be explicit and repeatable. Save pass-one and pass-two images side by side, then record the settings used for the accepted frame.
- Silhouette: compare the product outline with the source reference. Look for widened edges, missing corners, and asymmetry.
- Scale: compare the product with nearby objects and the tabletop plane. A correct shadow cannot rescue an incorrect scale.
- Light: check highlight direction, shadow softness, and color temperature across the product and environment.
- Contact: inspect the lowest edge, cast shadow, and any reflection. The product should appear to carry weight.
- Surface: inspect labels, seams, controls, and repeated patterns at 100%.
- Composition: confirm that pass two did not crop, rotate, or re-center the approved frame.
- Output: open the exported file independently and verify dimensions, color mode, transparency behavior, and compression.
These checks describe a method, not a result from a run in this environment. The workspace for this article did not include a ComfyUI installation, model files, or a rendered reference image, so no generation time, quality score, or success rate is claimed.
Common failure cases
The product looks pasted on
First check the contact shadow and local color. If the object has a strong outline, reduce edge contrast in the mask transition and let a small amount of surrounding light enter the product region. Revisit the light direction before adding more realism keywords.
The label changes between passes
Lower pass-two denoise, tighten the identity mask, and strengthen the visual reference. If the label is commercially important, render the scene and product separately, then restore the verified label in a controlled compositing step.
The second pass reframes the image
This usually means the upscale branch is still being asked to solve composition. Lock the canvas, use a lower denoise, and restrict the mask. If the scene must change, return to pass one rather than trying to force a local branch to repair a global decision.
Edges are sharp but lighting is wrong
Detail is not integration. Re-run pass one with a clearer light description, a better structural guide, or a simpler background. Pass two should not be used to invent a new lighting scheme after the composition is frozen.
The background becomes over-detailed
Reduce prompt emphasis on texture and keep the detail mask local. If the background is already acceptable, preserve it as a locked layer and refine only the product region.
Limitations and practical trade-offs
Two passes do not eliminate model-specific failure. Transparent packaging, reflective chrome, glass, thin cables, tiny typography, and products with strict geometric tolerances remain difficult. A workflow that is stable for a matte bottle may fail on a glossy device because reflections encode the whole environment.
The method also costs more than a single generation because it creates intermediate images and requires review. That cost is usually justified when composition and product identity have different priorities. For quick moodboards, one pass may be sufficient. For final advertising artwork, plan for manual cleanup and independent brand verification.
Keep a small record beside each accepted image: source filename, checkpoint identifier, control settings, masks, seeds, output dimensions, and manual edits. This makes the result reproducible even when the exact visual output cannot be recreated after model or node updates.
Final recipe
Use pass one to answer: “Does this product belong in this scene?” Use pass two to answer: “Does the approved product still hold up at final size?” Freeze composition between those questions. Maintain a saved reference, keep masks intentional, change one variable at a time, and treat generated detail as something to verify rather than assume.
For related workflows and definitions, continue with the guides and the glossary.