home/ modules/ performing-live-ai-visuals-in-a-rig

Performing Live AI Visuals in a Real-Time Rig

  • learner can drive real-time img2img from a live screen/webcam feed and stylise video frame-by-frame
  • learner can host and route AI generation inside TouchDesigner as part of a full AV rig
  • learner can manage latency and stability trade-offs while performing generative visuals live

Perform a 5-minute live AV set where AI visuals react in real time: feed a screen region or webcam into StreamDiffusion img2img, host the pipeline in TouchDesigner via the StreamDiffusionTD operator, switch between txt2img and img2img modes on the fly, and also render an offline vid2vid stylised clip as a pre-rendered backdrop — documenting the latency choices you made under performance pressure.

This module is where real-time diffusion stops being a benchmark and becomes an instrument. The whole task is a short live AV set — the kind you’d play at an algorave or a club visuals slot — where the AI layer is not a pre-rendered video but a living process: whatever your screen or webcam shows gets re-diffused frame by frame, steered by prompts you change mid-set, all composited inside TouchDesigner alongside the rest of your rig. In that setting, a dropped pipeline or a two-second latency spike is not a footnote; it is the performance failing in front of an audience.

The arc starts supported: run the screen-capture-to-img2img loop standalone, changing prompts live to feel how the feedback loop responds (the screen-region-as-diffusion-input pattern is your first JIT how-to). Then pre-render a stylised clip with the vid2vid procedure — same wrapper, file in, file out — which doubles as an offline sandbox for prompt and model choices. Next, move the pipeline inside TouchDesigner using the StreamDiffusionTD operator so diffusion output routes like any other texture in the node graph. Only then do you rehearse the unsupported capstone: mode switches, prompt steering, and mixing the live layer over your pre-rendered backdrop.

The required atoms gate the capstone directly: you cannot switch modes on the fly without knowing the img2img/txt2img latent and CFG constraints, cannot host the pipeline without the TD integration atoms, and cannot defend your latency choices without understanding why StreamDiffusion is fast at all — Stream Batch, RCFG, and the realistic fps envelopes are the vocabulary of that latency documentation. Supporting atoms deepen the craft: the wrapper-vs-raw API split, the similarity filter’s frame-skipping economics, a transferable segment-size-vs-VRAM budgeting principle (drawn from audio stem separation, useful when your rig shares one GPU across processes), and the live-coding culture debate about what AI assistance means on stage.

Atoms in this module

Required — these gate the capstone

A screen region or webcam feed can be the continuous image source for real-time img2img diffusion
Concept L3 Craft KI
img2img and txt2img mode in StreamDiffusion differ in their latent initialization and CFG constraints
Concept L3 Craft K
StreamDiffusion can process offline video frame-by-frame with img2img to produce a stylised output video
Procedure L3 Craft KI
TouchDesigner can host real-time AI/ML pipelines for generation, tracking, and stylisation in a live AV rig
Concept L3 Craft KI
The StreamDiffusionTD operator wraps StreamDiffusion as a TouchDesigner node for diffusion-based real-time visuals inside a TD network
Procedure L3 Craft KI
StreamDiffusion achieves real-time AI image generation by batching denoising steps and skipping redundant frames
Concept L3 Craft K

Supporting — enrichment, not gating

StreamDiffusionWrapper provides a high-level production interface; the raw StreamDiffusion class gives full control
Concept L3 Craft K
The Stochastic Similarity Filter skips GPU work probabilistically when consecutive frames are nearly identical
Concept L3 Craft K
Processing audio in short segments reduces GPU memory at the cost of segment-boundary artefacts
Principle L2 First instrument K
The live-coding community values human struggle and failure over AI-generated output
Concept L0 Orientation KF