Nodes/raylight/VideoTriangleCFGGuidance (Ray)
ComfyUI Node

VideoTriangleCFGGuidance (Ray)

VideoTriangleCFGGuidance (Ray)

By komikndr·Created about a year ago·Updated 2 days ago· 409
VideoTriangleCFGGuidance (Ray)
  • ray_actors
  • ray_actors
min_cfg1.0

If you've ever made a looping video and watched the seam - the last frame and the first frame clearly not matching - this node exists for exactly that problem. VideoTriangleCFGGuidance (Ray) ramps your CFG up and back down across the sequence, so the start and end of your clip get gentle guidance and the middle gets the full treatment. Loops land softer on both ends, which is precisely what makes them loopable.

It's Raylight's sibling to VideoLinearCFGGuidance: same pack, same Raylight/extra/guidance category, same shape as a node. Raylight is Komikndr's multi-GPU kit for ComfyUI - the "two 5070s instead of a 5090" crowd - splitting work across GPUs with USP sequence parallelism and sharding weights with FSDP. This node is a patch on the model in your RAY_ACTORS chain, not a sampler.

How it works

Where the linear variant climbs from min_cfg to full CFG and stops, this one takes that ramp and mirrors it. The code builds a sawtooth across the batch:

values = 2 * abs(linspace(0, 1, n) - floor(linspace(0, 1, n) + 0.5))
scale = values * (cond_scale - min_cfg) + min_cfg

Read that as: guidance starts at min_cfg, ramps to your sampler's CFG in the middle, and eases back to min_cfg at the end. For a loop, the last frame and first frame are generated under near-identical, low guidance, which is the single biggest thing you can do to make the seam invisible. It's the same idea as easing in/out in animation, applied to how hard the model is steered.

The inputs

Same minimal footprint as its sibling:

  • ray_actors - in, then out. Wire from your model loader through to the sampler.
  • min_cfg (default 1.0) - guidance at both ends of the clip. Lower = softer loop seam, but flat starts; raise it if your opening and closing frames feel detached from the prompt.

Install

Part of the raylight pack - Manager install by searching raylight, or:

cd ComfyUI/custom_nodes
git clone https://github.com/komikndr/raylight
cd raylight
<your_python> -m pip install -r requirements.txt

No extra deps beyond the pack's usual ray + xfuser set. Restart ComfyUI and the node shows up under Raylight → extra → guidance.

Gotchas

Two things trip people up. First, wiring: this must sit between the Load Diffusion Model (Ray) and the sampler, since it patches the model that flows through ray_actors. Second, don't stack it with the linear guidance node on the same chain - both override the CFG function and the last one wins, so you'll get one ramp, not a blend, and you'll be confused about which is doing the work. Pick one, learn its behavior, and only change min_cfg.

CategoryRaylight/extra/guidance

Inputs (2)

NameTypeDefaultDescription
ray_actorsRAY_ACTORS
min_cfgFLOAT1.00–100

Outputs (1)

NameTypeDescription
ray_actorsRAY_ACTORS