Real-time
Concept
TouchDesigner Recipes
Copy-paste starting points for real-time visuals — Python, GLSL, and CHOP wiring.
The problem
TouchDesigner is the fastest way to get a projection, an installation, or a data-driven visual on screen — but the blank network is intimidating and the same three or four patterns come up every single time. Students burn a whole afternoon rediscovering how to drive a parameter from audio or scatter points on a surface.
What this does
A small, growing set of TouchDesigner recipes you can drop straight into a network: an Execute DAT that maps audio level to any parameter, a GLSL TOP that displaces a grid, and a Script SOP that scatters a point cloud. Not a full tool — a cheat sheet you copy from.
What this is
A pocket of TouchDesigner snippets that solve the problems that always come up first. Copy a block into the matching operator, wire it up, and you have a working starting point instead of a blank network.
Recipe 1 — Audio-reactive parameter (Python, Execute/DAT)
Put this in a DAT Execute watching an Analyze/Audio CHOP, and it will drive any parameter from the live audio level. Great for making geometry breathe with sound.
# onValueChange or in an Execute DAT's onFrameStart
def onFrameStart(frame):
level = op('audioAnalyze')['chan1'].eval() # 0..1 envelope
target = op('geo1')
# smooth so it doesn't jitter
smooth = target.par.scale.eval() * 0.85 + (0.5 + level * 2.0) * 0.15
target.par.scale = smooth
return
Recipe 2 — Displace a grid (GLSL TOP)
A minimal GLSL TOP pixel shader that pushes a grid around with a noise field. Feed it a Noise TOP on input 0 and animate uTime from a Constant CHOP.
uniform float uTime;
out vec4 fragColor;
void main() {
vec2 uv = vUV.st;
vec4 n = texture(sTD2DInputs[0], uv + uTime * 0.05);
vec2 disp = (n.rg - 0.5) * 0.1;
vec4 col = texture(sTD2DInputs[0], uv + disp);
fragColor = TDOutputSwizzle(col);
}
Recipe 3 — Scatter a point cloud (Script SOP)
A Script SOP that scatters N points inside a unit cube — a quick source for instancing or a point-cloud look without importing anything.
# Script SOP — cook()
def cook(scriptOp):
scriptOp.clear()
import random
random.seed(1)
n = int(op('constant1')['count'] or 2000)
for i in range(n):
p = scriptOp.appendPoint()
p.x = random.uniform(-1, 1)
p.y = random.uniform(-1, 1)
p.z = random.uniform(-1, 1)
return
How to use these
- Create the operator named in each recipe (DAT Execute, GLSL TOP, or Script SOP).
- Paste the block into its code / DAT.
- Rename the referenced operators (
audioAnalyze,geo1,constant1) to match your own network.
Roadmap
This is a concept entry — a living cheat sheet. Planned additions: a Kinect/point-cloud ingest recipe, an NDI-in/out pair for multi-machine shows, and a TOX component that packages the audio-reactive rig into a drop-in module.