React Oldschool Tube Shaders
Classic cylindrical tunnel effect with Voronoi patterns and bump mapping. Pure WebGL retro tunnel for React with TypeScript and shadcn/ui—smooth GPU oldschool vibes.
Building tunnel effects?
Join our Discord community for help from other developers working with WebGL shaders.
Look, we've all tried to build oldschool tunnel effects. You either end up with basic CSS rotations that look nothing like proper demoscene tunnels or complex 3D libraries that can't handle cylindrical mapping smoothly. This React component uses authentic WebGL cylindrical mapping with Voronoi patterns and bump mapping that actually runs at 60fps without melting your CPU.
Smooth oldschool tunnel animation
Classic demoscene-style cylindrical tunnel with realistic Voronoi patterns and bump-mapped surfaces that won't destroy your performance metrics:
Created by Shane in 2016-10-21
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL cylindrical mapping with Voronoi pattern generation, bump mapping, and realistic lighting effects. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/oldschool-tube-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/oldschool-tube-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/oldschool-tube-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/oldschool-tube-shaders.json
Usage
import { OldschoolTubeShaders } from "@/components/ui/oldschool-tube-shaders";
export default function Hero() {
return (
<OldschoolTubeShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</OldschoolTubeShaders>
);
}
Why most tunnel implementations suck
Most developers try to create tunnel effects with CSS transforms or basic WebGL. Bad idea. You're dealing with unrealistic perspective distortion, poor pattern mapping, and wondering why your React app feels sluggish. Some use Three.js with complex geometry, which sounds smart until you realize you're computing thousands of vertices for a simple cylindrical surface.
This React component uses mathematical cylindrical mapping with authentic Voronoi pattern generation and function-based bump mapping. The GPU handles everything using optimized distance calculations with realistic lighting and edge detection. No JavaScript calculations, no geometry overhead, just smooth 60fps mathematical tunnel rendering.
Features
- Zero JavaScript tunnel overhead - Pure WebGL cylindrical mapping runs on GPU
- Voronoi pattern generation with sophisticated hash functions for authentic tunnel textures
- Function-based bump mapping for realistic surface detail and depth perception
- Edge detection algorithms built into bump mapping for enhanced visual definition
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 4 props for complete tunnel control
- Performance optimization through efficient cylindrical algorithms
- shadcn/ui compatible for consistent design systems
- Responsive design with automatic canvas resizing
API Reference
OldschoolTubeShaders
Main container component for the oldschool tunnel effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Tunnel movement speed (0.1 to 3.0) |
rotationSpeed | number | 1.0 | Camera rotation speed (0.1 to 3.0) |
colorScheme | number | 0 | Color theme (0: Platinum, 1: Gold, 2: Egyptian) |
bumpIntensity | number | 1.0 | Surface bump mapping intensity (0.1 to 3.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
Common gotchas
Animation not working: WebGL might not be supported in the browser. The component logs warnings when WebGL initialization fails. Check browser compatibility.
Performance issues on mobile: Some older phones struggle with complex Voronoi calculations and bump mapping. Consider reducing speed and bumpIntensity props for better performance.
Tunnel too fast/slow: Adjust the speed
prop to control forward movement through the tunnel. Lower values create gentle drifting, higher values create rapid tunnel flight.
Camera rotation too chaotic: Use the rotationSpeed
prop to control camera movement. Values around 0.5-0.7 work well for subtle environmental rotation.
Surface too flat/detailed: Lower the bumpIntensity
prop for smoother surfaces. Values around 0.3-0.7 create subtle bump effects without visual noise.
You might also like
Explore other shader-based background components for React applications:
Desert Sand Shaders
Realistic desert terrain with procedural sand textures
Matrix Shaders
Digital rain effects with authentic Matrix aesthetics
Cosmic Waves Shaders
Ethereal wave patterns with cosmic color palettes
Biomine Shaders
Organic tunnel structures with gyroid surfaces
Monster Tunnel Shaders
Fractal geometry tunnel with organic patterns
Nebula Shaders
Cosmic nebula patterns with deep space aesthetics
Questions developers actually ask
React Noise Shaders
React noise with GPU procedural generation. Advanced noise patterns for Next.js with TypeScript and shadcn/ui—free code.
React Perspex Web Lattice
Raymarched Voronoi lattice with perspex-like materials and edge detection. Pure WebGL geometric patterns for React with TypeScript and shadcn/ui—smooth GPU crystalline structures.