Nodes/AnimateDiff Evolved/ContextRef Modeβ—†First πŸŽ­πŸ…πŸ…“
ComfyUI Node Runs on cloud

ContextRef Modeβ—†First πŸŽ­πŸ…πŸ…“

Anchor every window to frame one

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
ContextRef Modeβ—†First πŸŽ­πŸ…πŸ…“
    • CONTEXTREF_MODE

    Of the two ways to tell ContextRef which context window should act as its reference, this is the simple one: always use the very first window. No configuration, no inputs at all - you drop it, wire its output into ContextRef's contextref_mode (or a Keyframe node's mode_replace), and every later window in your sliding-context render gets pulled back toward whatever look got established at the very start of the animation.

    What it does

    Zero inputs, one output: CONTEXTREF_MODE. That's the whole node. It exists purely so ContextRef has an explicit, named "use the first window" mode to select, rather than needing you to hand it an index yourself.

    Why "first" is the sensible default

    Whatever identity, color grading, and style your model settles on for the very first chunk of frames is usually the thing you'd want the rest of the video to match - it's the reference a viewer forms first, and it's the one AnimateDiff itself is building from. Using it as the anchor for every later window is the most intuitive read of "keep this animation looking like itself," and it's the mode to reach for before trying anything more elaborate.

    When it's not enough

    If your animation changes scene, costume, or lighting setup partway through, locking everything to frame one fights the change you actually want - the back half will keep getting pulled toward a look it's supposed to be leaving. That's what ContextRef Mode Β· Indexes is for: picking additional or replacement reference points partway through the render instead of only the very first window.

    Pairing it with a Tune node

    Mode Β· First only decides which window is the reference - it says nothing about how strongly that reference gets applied. Pair its output with a Tune Β· Attn or Tune Β· Attn+Adain node on ContextRef's contextref_tune input if the default blend feels too weak or too strong; mode and tune are independent knobs, and you'll usually end up touching both once you move past the out-of-the-box settings.

    Installing it

    Same install as the rest of the pack: ComfyUI Manager, search AnimateDiff Evolved, author Kosinkadink, install and restart - or git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved into custom_nodes manually.

    One honest note

    There's essentially no public discussion of ContextRef's modes to draw troubleshooting from - this is a genuinely under-documented corner of the pack, part of the "novel" techniques the README name-drops rather than a mainstream, widely-tutorialed feature. The upside is this particular node has nothing to misconfigure; if ContextRef isn't behaving the way you expect with Mode Β· First wired in, the problem is almost certainly elsewhere in the chain - most commonly, forgetting to route everything through Set Context Extras - rather than in this node itself.

    CategoryAnimate Diff πŸŽ­πŸ…πŸ…“/context opts/context extras/contextref

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    CONTEXTREF_MODECONTEXTREF_MODEβ€”