BadSandwich
- Active · last change 4-12-2026
- ★ 5 on GitHub
README
Bad Sandwich!! - Old Camera Effect Player
A retro-styled video player featuring Bad Sandwich shadow art video with real-time old camera effects including chromatic aberration, noise, and lens distortion.
🎬 Overview
This project plays the "Bad Sandwich!!" video with a vintage camera shader effect. The video data and audio are embedded directly into the executable, making it a self-contained application.
✨ Features
- Full video playback of Bad Sandwich!! with synchronized audio
- Old camera shader effects:
- Chromatic aberration (RGB channel offset)
- Dynamic noise pattern
- Screen distortion (lens warp)
- Vignette frame effect
- Horizontal scanline interference
- Smooth logo intro with fade in/out animation
- Real-time frame synchronization with audio position
- Optimized rendering using render textures and GPU shaders
🎮 Controls
- ESC or close window - Exit the application
🛠️ Technical Details
Built With
- Free Pascal / Object Pascal
- Raylib 5.5 - Graphics and audio library
- ray4laz - Pascal binding for Raylib
- OpenGL Shading Language (GLSL) - Fragment shader for visual effects
Architecture
- Embedded compressed video data (ZIP compression)
- Audio streaming from embedded MP3 data
- Frame-accurate video sync using audio playback position
- GPU-accelerated shader effects
Video Format
- Resolution: Original frame dimensions (embedded in data)
- Format: 1-bit per pixel (black/white)
- Frames: 30 FPS playback
Note: The unit is named
BadAppleDataPack.pasfor historical reasons, but the content is Bad Sandwich!! video.
🚀 Building with ray4laz
Prerequisites
- Free Pascal Compiler (FPC) 3.2.0 or higher
- Lazarus IDE (recommended) or FPC command line
- ray4laz - Pascal binding for Raylib 5.5
Installation
Option 1: Using Lazarus Online Package Manager (OPM)
- Open Lazarus IDE
- Navigate to Package → Online Package Manager
- Search for
ray4laz - Click Install and rebuild the IDE
Option 2: Manual Installation
git clone https://github.com/GuvaCode/ray4laz.gitThen add the source path to your project or compiler options.
Compilation
Using Lazarus IDE
- Open the project in Lazarus IDE
- Ensure ray4laz package is installed (see installation above)
- Press Ctrl+F9 or go to Run → Build
Using FPC Command Line
fpc -MOBJFPC badsandwich.lpr -Fu"path/to/ray4laz/source"🎨 Shader Details
The old camera effect is achieved through a custom GLSL fragment shader that applies:
| Effect | Description |
|---|---|
| Chromatic Aberration | RGB channels are offset slightly |
| Film Noise | Dynamic random grain overlay |
| Lens Distortion | Barrel distortion effect |
| Vignette | Darkened edges mimicking old lenses |
| Scanlines | Horizontal interference patterns |
📚 Learning Resources
- ray4laz GitHub Repository - Main binding repository
- Ray4Laz Examples - 180+ code examples
- Raylib Official Website - Documentation and references
📝 Notes
- The video data is compressed using ZLib and decompressed at runtime
- Audio is streamed directly from memory (no temporary files)
- The shader runs in real-time on the GPU
- Logo intro duration: ~5.5 seconds total (0.5s fade in, 4s display, 1s fade out)
📄 License
This project uses the "Bad Sandwich!!" video and audio content. All rights to the original content belong to their respective owners. The code implementation is provided for educational purposes.
🙏 Credits
- Original "Bad Sandwich!!" content
- Raylib by Ramon Santamaria
- ray4laz by GuvaCode - Pascal bindings for Raylib

