Shader system overview
GameLord’s shader pipeline is built for flexibility and performance:- WebGL2-powered - Hardware-accelerated rendering with GLSL shaders
- Multi-pass support - Chain multiple shader passes for complex effects
- Real-time switching - Change shaders on-the-fly without restarting
- Per-system presets - Different systems can remember different shader preferences
- Fallback handling - Automatic fallback to simpler shaders if compilation fails
All shaders run on the GPU via WebGL2. On modern hardware, even complex multi-pass shaders maintain 60 FPS.
Available shader presets
GameLord includes 18 built-in shader presets optimized for different display types and aesthetic preferences.CRT Shaders
Authentic cathode ray tube simulation for retro systems:CRT Aperture
CRT Aperture
Simulates an aperture grille CRT (like Sony Trinitron):
- Vertical shadow mask pattern
- Scanlines and phosphor bloom
- Slight barrel distortion
- Best for arcade and console games
CRT Fast
CRT Fast
Lightweight CRT effect with minimal performance cost:
- Basic scanlines
- Subtle curvature
- Single-pass shader (very fast)
- Good for lower-end GPUs
CRT Caligari
CRT Caligari
Named after the silent film aesthetic:
- Dramatic barrel distortion
- Heavy vignetting
- Strong phosphor glow
- Cinematic feel
CRT Geom
CRT Geom
Geometric CRT simulation:
- Physically-based curvature
- RGB phosphor triad
- Halation and bloom
- Multi-pass (heavier GPU load)
CRT Geom Deluxe
CRT Geom Deluxe
Enhanced version of CRT Geom:
- Additional glow pass
- Refined scanline algorithm
- Improved color reproduction
- Highest quality CRT effect
LCD Shaders
Handheld console LCD screen simulation:LCD PSP
LCD PSP
Simulates the PSP’s TFT LCD screen:
- Subpixel grid (RGB stripe)
- Slight backlight bleed
- Sharpened pixels
LCD GBA
LCD GBA
Game Boy Advance LCD effect:
- GBA color matrix (corrects washed-out colors)
- Subpixel grid with LCD response
- Accurate to original hardware
LCD GBA + Motion Blur
LCD GBA + Motion Blur
LCD GBA with ghosting:
- Simulates LCD response time
- Motion blur trails on fast movement
- Authentic to GBA’s slow refresh rate
Upscaling and Filtering
Sharp pixel scaling and smoothing:Nearest Neighbor
Nearest Neighbor
Pure pixel-perfect scaling:
- No filtering or smoothing
- Sharp, blocky pixels
- Zero performance cost
- Best for pixel art purists
Linear
Linear
Basic bilinear filtering:
- Smooth, slightly blurred
- Reduces pixel aliasing
- Good for low-resolution games
Sharp Bilinear
Sharp Bilinear
SABR (Scale and Blur Reduction)
SABR (Scale and Blur Reduction)
Edge-directed upscaling:
- Detects diagonal edges
- Smooths curves without blur
- Good for 2D sprites
xBRZ Freescale
xBRZ Freescale
Advanced pixel art scaler:
- Anti-aliased edges
- Preserves sharp details
- Heavy GPU load (multi-pass)
- Best at 4x+ scaling
Stylistic Effects
Artistic filters and retro aesthetics:Pixellate
Pixellate
Chunky pixel effect:
- Artificially enlarges pixels
- Retro demoscene aesthetic
- Configurable block size
Dither
Dither
Ordered dithering:
- Reduces color depth
- Bayer matrix pattern
- Game Boy-style look
Halftone
Halftone
Print-style dot pattern:
- CMYK halftone dots
- Comic book aesthetic
- Adjustable dot size
NTSC Adaptive
NTSC Adaptive
Composite video artifacts:
- NTSC color fringing
- Dot crawl and rainbowing
- Authentic to RF/composite output
- Adjusts per-system
Motion Blur
Motion Blur
Temporal blending:
- Accumulates previous frames
- Cinematic motion blur
- Reduces flicker on interlaced games
Changing shaders
Open the shader menu
While playing a game, hover the mouse to reveal the control overlay, then click the “Shaders” button.
Performance considerations
Single-pass vs. multi-pass shaders
Single-pass shaders (fastest):- Nearest, Linear, Sharp Bilinear, CRT Fast
- Execute once per frame
- Minimal GPU overhead
- Safe for all hardware
- CRT Geom, CRT Geom Deluxe, xBRZ, NTSC Adaptive
- Render to intermediate textures
- Chain multiple effects
- Require more VRAM and GPU time
GPU bottlenecks
Factors that affect shader performance:- Window size - Larger windows = more pixels to shade
- Pass count - Each pass adds GPU cost
- Texture lookups - Complex filters sample neighboring pixels
- GPU capabilities - Integrated GPUs may struggle with heavy shaders
On Apple Silicon Macs (M1/M2/M3), even the most complex shaders run smoothly at 60 FPS thanks to unified memory and powerful GPU cores.
Testing shader performance
Display type recommendations
CRT-era systems (1980s-1990s)
These systems were designed for CRT displays:- NES, SNES, Genesis - CRT Aperture or CRT Geom
- Arcade - CRT Aperture (matches arcade monitors)
- PlayStation, Saturn - CRT Geom Deluxe (3D games benefit from bloom)
Handheld systems
LCD screens with unique characteristics:- Game Boy Advance - LCD GBA or LCD GBA + Motion Blur
- PSP - LCD PSP
- Game Boy / Game Boy Color - Dither preset (mimics monochrome LCD)
- Nintendo DS - LCD PSP or Sharp Bilinear
Modern LCD/OLED displays
For pixel-perfect clarity on modern screens:- All systems - Nearest Neighbor (pure pixels) or Sharp Bilinear (slight smoothing)
- High-DPI displays - xBRZ Freescale (scales beautifully to 4K+)
Custom shader development
GameLord currently uses built-in GLSL shaders. Future versions will support loading Slang (
.slang/.slangp) presets from the libretro shader ecosystem.- Shader language - GLSL (OpenGL Shading Language)
- Entry points - Vertex and fragment shaders per pass
- Uniforms - Texture resolution, output size, frame count, etc.
- Texture samplers - Access to source frame and intermediate passes
- LUT support - Load lookup textures for color grading
packages/ui/webgl/shaders.ts and packages/ui/webgl/presets/ for examples.
Troubleshooting
Shader causes frame drops
Shader causes frame drops
- Switch to a single-pass shader (Nearest, Linear, CRT Fast)
- Reduce window size (less pixels to shade)
- Check GPU utilization in Activity Monitor / Task Manager
- Some shaders are GPU-heavy by design (CRT Geom Deluxe, xBRZ)
Shader doesn't apply / black screen
Shader doesn't apply / black screen
- Check browser console for WebGL errors (Help > Toggle Developer Tools)
- Shader compilation may have failed - check for GLSL syntax errors
- WebGL2 may not be available (very old GPU or browser)
- Try switching to “Default” preset to reset
Colors look wrong
Colors look wrong
- Some shaders alter color reproduction (GBA Color Matrix, NTSC Adaptive)
- CRT shaders add phosphor bloom which desaturates bright colors
- Check that the shader is appropriate for the system (don’t use LCD GBA on NES)
- Switch to Nearest or Linear for unmodified colors
Image looks blurry
Image looks blurry
- Linear and bilinear shaders intentionally blur pixels
- Use Nearest Neighbor or Sharp Bilinear for crisp pixels
- Some CRT shaders add bloom/halation which softens the image
- Window size affects sharpness - try resizing