This update implements the complete Grandmaster Plan with four major enhancements:
- Custom GLSL Shaders - Immortal (gold iridescent) and Damaged (red glitching) effects
- Precise Sync Logic - <100ms jitter synchronization with server timestamp
- Immediate Removal - Cross-fade transition when health hits -10
- Cyberpunk Post-Processing - Bloom, Chromatic Aberration, Scanlines, Noise, Vignette, Glitch
npm install postprocessingCopy the files from this zip to your project, maintaining the directory structure:
your-project/
├── src/
│ ├── components/
│ │ └── DNAHelix/
│ │ ├── shaders/ # NEW FOLDER
│ │ │ ├── ImmortalShaderMaterial.tsx
│ │ │ ├── DamagedShaderMaterial.tsx
│ │ │ └── index.ts
│ │ ├── HelixRung.tsx # MODIFIED
│ │ └── types.ts # MODIFIED
│ └── pages/
│ └── RadioPage.tsx # MODIFIED
└── server/
├── index.js # MODIFIED
└── state.js # MODIFIED
Custom GLSL shader for songs that reach +10 health (immortal status):
- Gold base color with pulsing intensity
- Iridescent rainbow shift based on view angle
- Fresnel edge glow effect
- Sparkle particles
- Subtle vertex displacement for organic movement
Custom GLSL shader for songs with health ≤ -5:
- Red emissive base with procedural cracks (simplex noise)
- RGB split glitch effect triggered randomly
- Scanline overlay
- Flickering based on damage level
- Vertex jitter displacement
Barrel export file for shader materials.
- Integrates both custom shader materials
- Dynamically switches materials based on song health
- Animates shader uniforms via
useFramehook - Adds node spheres at helix connection points
- Displays aura effect for immortal songs
- Shows glitch particles for damaged songs
- Includes health indicator bar for current song
- Added
youtubeId?: stringfield to Song interface - Added
duration?: numberfield to Song interface
Sync Logic Improvements:
- NTP-style ping/pong for calculating server time offset
- Continuous sync check every 2 seconds
- 100ms drift threshold for seeking
- Visual sync status display (drift, offset)
Cyberpunk Post-Processing Stack:
Bloom- intensity 2.0, radius 0.8, 8 mipmap levelsChromaticAberration- radial modulation for edge distortionScanline- overlay blend at 8% opacityNoise- film grain at 15% opacityVignette- 0.7 darkness for focusGlitch- dynamic, triggered on removal events
UI Enhancements:
- Cross-fade transitions on song change
- Sync status panel with real-time drift display
- Visual feedback for voting actions
- Improved progress and health bars
- Immediate removal when health hits -10
- Cross-fade support with 300ms transition delay
- Pre-fetches next song's YouTube ID
- Emits
song_removedandsong_immortalevents - Includes
serverTimein state for sync
- Ping/pong handler for time synchronization
- Broadcasts removal and immortal events
- Low-latency WebSocket configuration
- New
/api/syncendpoint for debugging
- On connect, client sends
pingwith local timestamp - Server responds with
pongcontaining both client and server timestamps - Client calculates round-trip time and server offset
- All playback positions are adjusted using this offset
- Sync checks run every 2 seconds; if drift > 100ms, player seeks
Immortal (health ≥ 10):
- Song status changes to
'immortal' - Gold iridescent shader activates
- Aura sphere surrounds the rung
- Text displays "★ IMMORTAL ★"
Damaged (health ≤ -5):
- Red glitching shader activates
- Intensity increases as health decreases
- At health ≤ -8, text displays "⚠ CRITICAL ⚠"
Removed (health ≤ -10):
- Song immediately removed from sequence
- Cross-fade transition to next song
- Glitch post-processing effect triggers
- Server broadcasts removal event
The cyberpunk aesthetic is achieved through layered effects:
- Bloom creates the neon glow on bright elements
- Chromatic Aberration adds color fringing at edges
- Scanlines provide retro-futuristic texture
- Noise adds film grain for atmosphere
- Vignette focuses attention on center
- Glitch triggers on song removal for dramatic effect
- Ensure
postprocessingpackage is installed - Check browser console for WebGL errors
- Verify shader files are in correct location
- Check server is running on port 3001
- Verify WebSocket connection in browser dev tools
- Look for sync status in UI (should show "Sync Active")
- Reduce
countin Stars component - Lower bloom
intensityorradius - Disable some post-processing effects
Grandmaster Plan v1.0
- Implemented: January 2026
- Compatible with: DNA Webapp Player base codebase
Custom GLSL shaders inspired by:
- Inigo Quilez's noise functions
- Three.js shader examples
- Cyberpunk 2077 visual aesthetics