# FlyLo Laser Trace · FFGL Effect Plugin

Edge-following laser pattern with stroboscopic + HSV controls. Drop into
your existing `flylo-layer3-ffgl` workspace and rebuild the Mac .bundle
(or Windows .dll) — same build flow as the rest of the LAYER3 suite.

## What it does

Sobel-edge detects the input texture each frame, then lights pixels
that lie ON an edge AND are NEAR a time-varying "laser" path. The
laser appears to trace the form's edges like a coherent beam writing
on the wall behind it.

**Three modes:**
- **Lissajous Trace** — three procedural Lissajous curves drift across
  the frame, each leaving an exponentially-fading trail of bright
  samples. Edges they cross over light up.
- **Scan Lines** — four sweeping infinite scan lines at 0°/45°/90°/135°,
  each at a slightly different speed. Edges crossed light up.
- **Both** — combine the above for maximum chaos.

**Controls:**
| Param | Range | Purpose |
|---|---|---|
| `Mode` | option | Lissajous / Scan Lines / Both |
| `Intensity` | 0–1 | Overall laser brightness multiplier |
| `Beam Thickness` | 0–1 | Width of the core bright line |
| `Hue / Saturation / Brightness` | HSV | Laser colour |
| `Speed` | 0–1 | Trace velocity (Lissajous frequencies + scan-sweep rate) |
| `Trail Length` | 0–1 | Number of past path samples summed (1..32) |
| `Strobe Rate` | 0–1 | 0..30 Hz stroboscopic gate |
| `Strobe Amount` | 0–1 | 0 = no chop, 1 = full on/off |
| `Edge Sensitivity` | 0–1 | Sobel boost — more edges count at higher values |
| `Glow` | 0–1 | Halo width around the bright core |
| `Mess Factor` | 0–1 | Per-pixel time jitter + path perturbation |
| `Background Fade` | 0–1 | 0 = keep input fully, 1 = full black behind laser |
| `Alpha` | 0–1 | Output alpha |

## Install (drop-in)

If you already have the `flylo-layer3-ffgl` workspace built and running:

1. Drop the `FlyLoLaserTrace/` folder from this zip into
   `flylo-layer3-ffgl/source/plugins/`
2. Open `CMakeLists.txt` and add this line in the plugin-registration
   block (alongside the other `add_ffgl_plugin(...)` calls):
   ```cmake
   add_ffgl_plugin(FlyLoLaserTrace)
   ```
3. Regenerate + build:

   **Mac:**
   ```bash
   cd flylo-layer3-ffgl
   cmake -B build -G Xcode
   cmake --build build --config Release
   # The .bundle lands in build/binaries/Release/
   cp -R build/binaries/Release/FlyLoLaserTrace.bundle \
     "$HOME/Library/Application Support/Resolume Arena 7/Extra Effects/"
   ```

   **Windows:**
   ```bash
   cd flylo-layer3-ffgl
   cmake -B build/windows -G "Visual Studio 16 2019" -A x64
   cmake --build build/windows --config Release
   # The .dll lands in binaries/x64/Release/
   ```

4. Restart Resolume. The plugin appears under the FFGL effects list as
   **FlyLo Laser Trace**.

## Suggested first-use settings

- Set **Mode** to `Lissajous Trace` for the chaotic moving-dots look,
  or `Scan Lines` for cleaner sweeping behaviour
- Push **Intensity** to ~0.8 and **Edge Sensitivity** to ~0.6
- Drop **Background Fade** to ~0.6–0.8 so the input becomes a dim
  template that the laser writes on
- Start **Strobe Amount** at 0, push to 0.5+ once you find a tempo
- **Mess Factor** ~0.3 keeps the look feeling like a "real" handheld
  laser rather than a digital sweep

## Notes

- Pure single-pass fragment shader — no feedback buffer or framebuffer
  pingponging, so it composes cleanly with other FFGL effects above /
  below in the layer stack.
- The "trail" is produced by sampling each path at N discrete time
  offsets and summing with exponential falloff — increase `Trail
  Length` for longer streaks, drop it for sharper dots.
- Strobe gate is independent of audio — it free-runs from the host
  clock. Map it to a MIDI knob in Resolume if you want tempo-synced
  stutter.
