Bash.tv → GitHub → itch.io

Custom visual effects with GLSL shaders for web games. A tested library of 2D fragment effects (hit flash, outline, dissolve, CRT, chromatic aberration, pixelate, palette swap, wave distortion, desaturate, hurt vignette), how to run them as post-processing or per sprite in raw WebGL2, Pixi filters, Phaser pipelines and three.js ShaderMaterial / passes, uniforms and time, premultiplied alpha, pr...

Download skill (.zip) Files on GitHub

Shader development

Library: assets/shaders.js, 10 effects compiled and rendered on a real GPU (check_gpu_render: 15/15 checks, including output pixels). Runner for raw WebGL2: webgl-rendering’s assets/gl.js.

import { FULLSCREEN_VERT, EFFECTS, DEFAULTS } from "./core/shaders.js";
import { createGL, fullscreenPass, renderTarget, texture } from "./core/gl.js";
const crt = fullscreenPass(gl, FULLSCREEN_VERT, EFFECTS.crt);
// render the game into a target, then: crt.draw(sceneTarget.tex, { uStrength: 0.8 });   // uTex, uRes, uTime are set for you
Effect Uniforms Use
flash uAmount, uColor Hit flash on sprites
outline uColor, uTexel Selection, interactables
dissolve uProgress Death, teleport
crt uStrength Retro filter (whole screen)
chroma uAmount (px) Big hit pulse
pixelate uSize Transitions, retro
palette uPal[4] Game Boy / limited palettes
wave uAmp, uFreq Water, heat
desaturate uAmount Pause, game over, memories
hurt uHurt Red vignette when damaged

In engines

Rules