Nodes/ComfyUI-DragNUWA/CompositeMotionBrush
ComfyUI Node

CompositeMotionBrush

CompositeMotionBrush

By chaojie·Created 3 years ago·Updated 2 years ago· 411
CompositeMotionBrush
  • model
  • motion_brush_layer0
  • motion_brush_layer1
  • MotionBrush
modeoverride

CompositeMotionBrush is where the "motion brush library" idea in this pack finally clicks. It takes two brushes - a base layer and an overlay layer - and merges them into one, so you can build a final motion field out of parts instead of trying to generate it all at once. Camera zoom on the base, object slide on top, one composite brush out the other end, straight into DragNUWA Run MotionBrush.

The merge logic is simple and worth knowing, because it's the one place the pack's "override" mode actually does something. For every pixel and every frame, it checks whether the overlay brush (motion_brush_layer1) has any motion at that location - any vector bigger than a hair above zero. If it does, the overlay wins and its value is written into the result. If not, the base layer's value is kept. That's it: the overlay only exists where it has motion, and everywhere else you get the base. There's a small amount of lookahead gap-filling in the code (a scan down/right a few dozen pixels to catch the edge of a masked region), but the mental model is "overlay where it moves, base everywhere else."

Inputs

  • model - the DragNUWA object, used to size the output tensor.
  • motion_brush_layer0 - the base layer.
  • motion_brush_layer1 - the overlay layer that takes priority wherever it has motion.
  • mode - a dropdown that currently offers exactly one choice: override. It's the only compositing mode this pack ever implemented, so treat it as decorative.

Output

One merged MotionBrush. Feed it to DragNUWA Run MotionBrush, or stack it further by feeding it back in as a layer - compositing is associative enough that a third brush can join the party.

Why you'd reach for it

It's the difference between fighting one brush and assembling a scene. The canonical example from the pack's motion-brush workflow: InstantCameraMotionBrush gives you a global pan, then an object brush (from InstantObjectMotionBrush or a masked BrushMotion) overrides the pan in the subject's region. Result: a pan that a moving subject rides on top of - a proper two-layer camera/subject move that neither brush alone can express.

The catch

The brush layers must share the same model_length and resolution, or the override logic is comparing tensors that don't line up. If you build a camera brush at 576x320/14 frames and an object brush from a differently-sized mask, the composite gets sloppy - motion bleeding in the wrong places or a layer that silently does nothing. Keep every generator in the same coordinate space.

Also note the model dependency. This node takes a DragNUWA model purely to know the dimensions - it does no inference on it. If you'd rather composite brushes without loading the multi-gigabyte checkpoint, CompositeMotionBrushWithoutModel is the exact same merge with the model input removed. Use that one for prototyping; use this one when you're already in a full run workflow anyway. Pack-level caveats apply as always - SVD-era quality, hardcoded cuda:0 at load, heavyweight requirements. But as a tool for staging motion piece by piece, this node (and its WithoutModel twin) is the pack's best idea.

CategoryDragNUWA

Inputs (4)

NameTypeDefaultDescription
modelDragNUWA
motion_brush_layer0MotionBrush
motion_brush_layer1MotionBrush
modeCOMBOoverride1 options: override

Outputs (1)

NameTypeDescription
MotionBrushMotionBrush