React Mobius Spiral Shaders
Raymarched 3D extruded Mobius spiral patterns with complex transformations. Pure WebGL spiral geometry for React with TypeScript and shadcn/ui—mathematical art meets performance.
Building complex spiral effects?
Join our Discord community for help from other developers working with WebGL shaders.
Creating beautiful 3D Mobius spirals is mathematically complex and computationally expensive. This React component uses advanced complex transformations and raymarching to render extruded Mobius spiral patterns that would be impossible with traditional 3D libraries, all while maintaining smooth 60fps performance.
Mathematical spiral geometry
Beautiful raymarched 3D Mobius spiral patterns with complex transformations and customizable extrusion shapes:
Created by Shane in 2022-01-08
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL raymarching with complex mathematical transformations, inverse hyperbolic tangent operations, and realistic lighting. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/extruded-mobius-spiral-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/extruded-mobius-spiral-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/extruded-mobius-spiral-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/extruded-mobius-spiral-shaders.json
Usage
import { ExtrudedMobiusSpiralShaders } from "@/components/ui/extruded-mobius-spiral-shaders";
export default function Hero() {
return (
<ExtrudedMobiusSpiralShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</ExtrudedMobiusSpiralShaders>
);
}
Why most spiral implementations fail
Most developers try to create Mobius spirals with simple 3D meshes or particle systems. Wrong approach. You're dealing with complex mathematical transformations that require precise control over every pixel. Traditional 3D libraries can't handle the inverse hyperbolic tangent operations and polar coordinate transformations needed for authentic Mobius geometry.
This React component uses advanced complex plane mathematics with raymarched distance fields and proper Lipschitz surface constraints. The GPU handles everything using optimized complex number operations with realistic lighting and ambient occlusion. No JavaScript calculations, no mesh generation overhead, just pure mathematical spiral rendering at 60fps.
Features
- Zero JavaScript spiral overhead - Pure WebGL raymarching runs on GPU
- Complex plane transformations using inverse hyperbolic tangent operations for authentic Mobius geometry
- Multiple spiral modes with single or double spiral configurations and customizable extrusion shapes
- Advanced surface details including hexagonal patterns, face decorations, and ridge effects
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 9 props for complete spiral control
- Performance optimization through efficient raymarching algorithms and distance field operations
- shadcn/ui compatible for consistent design systems
- Responsive design with automatic canvas resizing
API Reference
ExtrudedMobiusSpiralShaders
Main container component for the extruded Mobius spiral effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed multiplier (0.1 to 3.0) |
shape | number | 2 | Cross section shape (0: Square, 1: Circle, 2: Hexagon) |
rowOffset | number | 1 | Row offset for brickwork pattern (0: Off, 1: On) |
faceDecoration | number | 1 | Colorful face decorations (0: Off, 1: On) |
doubleSpiral | number | 1 | Double spiral mode (0: Single, 1: Double) |
holes | number | 0 | Bore holes in blocks (0: Off, 1: On) |
raised | number | 0 | Raised pylon faces (0: Off, 1: On) |
ridges | number | 0 | Ridge decorations on tops (0: Off, 1: On) |
vertLines | number | 0 | Vertical lines from center (0: Off, 1: On) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
Common gotchas
Spiral not appearing: Complex transformations require WebGL2 support. The component logs warnings when advanced WebGL features aren't available. Check browser compatibility.
Performance issues on mobile: Complex raymarching and mathematical operations are GPU-intensive. Consider reducing speed and disabling decorative features like ridges and holes for better mobile performance.
Blocky appearance: Ensure the shape parameter is set correctly. Hexagonal shapes (2) provide the smoothest appearance but require more processing power.
Animation stuttering: The complex plane transformations use intensive mathematical operations. Try reducing the number of enabled features or adjusting the speed parameter.
Colors too vibrant/dull: The face decoration system uses procedural coloring based on spiral mathematics. The appearance will vary based on the spiral configuration and shape settings.
You might also like
Explore other shader-based background components for React applications:
3-Tap Voronoi Shaders
Ultra-fast 3-tap Voronoi with simplex grid and highlights
Cellular Tiled Tunnel
Raymarched 2nd-order Voronoi tunnel with 3D cellular tiling
Perspex Web Lattice
Raymarched Voronoi lattice with perspex-like materials
Oldschool Tube Shaders
Classic cylindrical tunnel effect with Voronoi patterns
Abstract Mod Shaders
3D abstract raymarching with mathematical patterns
Retro Grid Shaders
Synthwave-style perspective grid with neon aesthetics
Questions developers actually ask
React Digital Tunnel Shaders
React digital tunnel with GPU 3D effects and neon rings. Futuristic tunnel backgrounds for Next.js with TypeScript and shadcn/ui—free code.
React 3D Fire Shaders
React 3D fire with volumetric raymarching. Realistic flame effects for Next.js with TypeScript and shadcn/ui—free code.