Lore

Distorting the inpaint mask to avoid shape bias in Wan

# Distorting the inpaint mask to avoid shape bias

In the video pass of AI video object replacement pipeline (reference frame, then video pass), the original car is segmented and its mask is altered before it goes to the Wan video model.

Problem

If the alpha or mask keeps the outline of the original car, the Wan video model tries to add a car in that shape. This pushes it back toward the original object, or toward a car of the wrong shape, instead of the replacement.

Fix

Use blockify mask and grow mask nodes. They enlarge the mask and change its shape so it no longer looks like a car. The model fills the region according to the prompt and reference, not the silhouette.

Trade-off

A larger, blockier mask gives the model more freedom, so it has to rely more on the reference image and the prompt (reference-image-driven-video-prompt). This is also why wheel motion is a weak spot, handled by a later inpaint pass.