Skip to content
Back to skills

Add Crt Effect

ASecurity

Stack fullscreen effects (CRT curvature, scanlines, bloom, glitch) on top of the finished frame. These run on WebGPU only.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
developmentbackend

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add blit386/blit386 --skill add-crt-effect --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Crt Effect?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Crt Effect
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blit386-add-crt-effect/badge)](https://www.skillsdirectory.com/skills/blit386-add-crt-effect)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-crt-effect
description:
  Stack fullscreen post-process effects (CRT curvature, scanlines, bloom, glitch) on top of the finished frame, which
  runs on WebGPU only. Use for a retro CRT look, screen glitches, bloom or glow, or any whole-screen filter.
---

# Add a CRT or post-process effect

Stack fullscreen effects (CRT curvature, scanlines, bloom, glitch) on top of the finished frame. These run on WebGPU
only.

## Step 1 (optional): a bigger output buffer

Display-tier effects (curvature, scanlines, mask, bloom) draw into the output buffer, not the logical screen. A game
with no `configure()` already gets `640x480`; a bigger one makes the CRT look sharper:

```js
configure() {
    return {
        displaySize: new Vector2i(320, 240), // you draw here
        drawingBufferSize: new Vector2i(1280, 960), // effects render here
    };
}
```

## Step 2: guard the software fallback, then add effects

Post-process throws on the Canvas 2D fallback, so check the active backend first:

```js
async init() {
    // ...palette and setup...
    if (BT.activeBackend === 'webgpu') {
        this.crt = BT.preset.crtPipBoy(); // a ready-made array of CRT effects
        for (const fx of this.crt) BT.effectAdd(fx);
    }
    return true;
}
```

Turn it off again (guard the same way - `this.crt` is never set on the software fallback):

```js
if (this.crt) {
  for (const fx of this.crt) BT.effectRemove(fx);
}
// or remove everything at once:
BT.effectClear();
```

## Step 3: make the moving parts move

The CRT preset holds four effects that animate, but none of them moves on its own: each one reads a field that your game
sets every frame. `Noise`, `Interference`, and `RollLine` read `time`; `Flicker` reads `amount`, its brightness. Without
this step the screen looks frozen.

```js
import { BT, Flicker, Interference, Noise, RollLine } from 'blit386';

render() {
    // ...draw the game...
    this.driveCrt();
}

driveCrt() {
    if (!this.crt) return; // the software fallback has no effects

    const t = BT.timeSeconds; // the game's own clock, so BT.renderAt can replay it
    for (const fx of this.crt) {
        if (fx instanceof Noise || fx instanceof Interference || fx instanceof RollLine) {
            fx.time = t;
        } else if (fx instanceof Flicker) {
            fx.amount = 0.97 + Math.sin(t * 40) * 0.03; // brightness wobbles between 0.94 and 1
        }
    }
}
```

## Step 4: respect reduced motion (engine 1.7.0+)

Some players ask their system for less motion because heavy movement makes them dizzy or unwell. The moving effects are
the first thing to tone down: `Flicker`, `Interference`, `RollLine`, `Noise`, and `PixelGlitch` all animate, and a
flickering, rolling CRT is exactly what that setting exists to suppress. Static curvature, scanlines, and vignette are
fine to leave on.

```js
async init() {
    if (BT.activeBackend === 'webgpu') {
        this.crt = BT.preset.crtPipBoy();
        this.applyMotionPreference();
    }
    return true;
}

applyMotionPreference() {
    if (!this.crt) return;

    // Keep the still parts of the look, drop the four that move (Step 3).
    const moving = [Flicker, RollLine, Interference, Noise];

    for (const fx of this.crt) BT.effectRemove(fx);
    for (const fx of this.crt) {
        if (BT.isReducedMotionPreferred && moving.some((Kind) => fx instanceof Kind)) continue;
        BT.effectAdd(fx);
    }
}

// Optional. Runs if the player changes the setting while the game is open.
onReducedMotionChange() {
    this.applyMotionPreference();
}
```

Then stop driving them too, so nothing moves even if one is added back later. The first line of `driveCrt()` becomes:

```js
if (!this.crt || BT.isReducedMotionPreferred) return;
```

`BT.isReducedMotionPreferred` is a getter (no parentheses). Screen shake you wrote yourself deserves the same
treatment - clamp its amplitude to `0` when the flag is set.

## Key calls

- `BT.effectAdd(effect)` / `BT.effectRemove(effect)` / `BT.effectClear()` - methods.
- `BT.isReducedMotionPreferred` (getter, engine 1.7.0+) - true when the player asked for less motion; optional
  `onReducedMotionChange(prefersReduced)` on your game class fires when that changes mid-session.
- Presets (functions on `BT.preset`): `BT.preset.crtPipBoy()`, `BT.preset.amber()`, `BT.preset.green()` - each returns a
  fresh array of effects.
- Effect classes you can construct, tweak, then `effectAdd`: display-tier `Scanlines`, `BarrelDistortion`, `Bloom`,
  `Vignette`, `RGBMask`, `ChromaticAberration`, `Noise`, `Flicker`, `Interference`, `RollLine`; pixel-tier
  `PixelGlitch`, `PixelMosaic`.

```js
import { Scanlines } from 'blit386';
const lines = new Scanlines();
lines.strength = 0.4;
BT.effectAdd(lines);
```

## Notes

- Always gate effects behind `BT.activeBackend === 'webgpu'` so the game still runs on the software fallback. Keep
  starter games effect-free.
- Gate on `BT.activeBackend`, **never** on `BT.requestedBackend`. `requestedBackend` is the backend you asked for, and
  it still says `'webgpu'` even after the engine has quietly fallen back to Canvas 2D - so a guard built on it passes on
  exactly the machines it was meant to protect, and `BT.effectAdd` throws there.
- Hold onto effect instances and reuse them; rebuilding every toggle re-allocates GPU pipelines.
- Full effect reference lives at blit386.dev (the ask-the-docs skill shows how to reach it); the local docs do not cover
  every effect.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.