React Smooth Voronoi Contours
Anti-aliased Voronoi contour lines with numerical gradient smoothing. Pure WebGL abstract patterns for React with TypeScript and shadcn/ui—smooth GPU contour visualization.
Building abstract contour effects?
Join our Discord community for help from other developers working with WebGL shaders.
Look, we've all tried to build smooth contour visualizations. You either end up with aliased fract patterns that look jagged at any resolution or complex anti-aliasing that destroys performance. This React component uses numerical gradient smoothing with Voronoi functions to create perfectly smooth contour lines that actually run at 60fps without melting your CPU.
Smooth anti-aliased contours
Mesmerizing Voronoi contour patterns with precise numerical gradient smoothing that won't destroy your performance metrics:
Created by Shane in 2016-04-29
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL numerical gradients with smooth Voronoi functions and anti-aliased contour generation. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/smooth-voronoi-contours-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/smooth-voronoi-contours-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/smooth-voronoi-contours-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/smooth-voronoi-contours-shaders.json
Usage
import { SmoothVoronoiContoursShaders } from "@/components/ui/smooth-voronoi-contours-shaders";
export default function Hero() {
return (
<SmoothVoronoiContoursShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</SmoothVoronoiContoursShaders>
);
}
Why most contour implementations suck
Most developers try to create contour lines with basic fract functions or CSS gradients. Bad idea. You're dealing with aliased edges, poor smoothing, and wondering why your React app looks pixelated. Some use SVG paths with JavaScript calculations, which sounds smart until you realize you're computing thousands of vectors on every frame.
This React component uses numerical gradient analysis with smooth Voronoi functions and distance estimation techniques. The GPU handles everything using optimized gradient calculations with authentic anti-aliasing and smooth contour generation. No JavaScript calculations, no aliasing artifacts, just smooth 60fps mathematical contour rendering.
Features
- Zero JavaScript contour overhead - Pure WebGL numerical gradients run on GPU
- Numerical gradient smoothing with sophisticated distance estimation for perfect anti-aliasing
- Smooth Voronoi functions for organic pattern generation and field value accumulation
- Dual rendering modes with standard and glossy contour visualization options
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 4 props for complete contour control
- Performance optimization through efficient gradient algorithms
- shadcn/ui compatible for consistent design systems
- Responsive design with automatic canvas resizing
API Reference
SmoothVoronoiContoursShaders
Main container component for the smooth Voronoi contour effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed multiplier (0.1 to 3.0) |
frequency | number | 12.0 | Contour line frequency (3.0 to 30.0) |
smoothness | number | 1.0 | Anti-aliasing smoothness (0.1 to 3.0) |
glossyMode | number | 0 | Rendering mode (0: Standard, 1: Glossy) |
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 gradient calculations and Voronoi functions. Consider reducing frequency and smoothness props for better performance.
Contours too dense/sparse: Adjust the frequency
prop to control contour line density. Lower values create fewer, wider bands, higher values create more detailed patterns.
Aliasing still visible: Increase the smoothness
prop for better anti-aliasing. Values around 1.5-2.0 work well for high-resolution displays.
Glossy mode not working: Set glossyMode={1}
to enable the raised surface rendering mode with enhanced highlighting and specular effects.
You might also like
Explore other shader-based background components for React applications:
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
Cosmic Waves Shaders
Ethereal wave patterns with cosmic color palettes
Soap Bubbles 2D Shaders
Realistic soap bubble simulation with procedural noise
Nebula Shaders
Cosmic nebula patterns with deep space aesthetics
Questions developers actually ask
React Smooth Noise Contours
Anti-aliased Simplex noise contours with smooth fract functions. Pure WebGL abstract patterns for React with TypeScript and shadcn/ui—smooth GPU noise visualization.
React Soap Bubbles 2D Shaders
Realistic soap bubble simulation with procedural noise and cellular patterns. Pure WebGL shaders for React with TypeScript and shadcn/ui—smooth GPU animations.