React Pyramid Pattern
Animated pyramid patterns with bump mapping and noise-driven offset tips. Pure WebGL geometric patterns for React with TypeScript and shadcn/ui—dimensional texture meets performance.
Building geometric pattern effects?
Join our Discord community for help from other developers working with WebGL shaders.
Creating convincing 3D pyramid patterns without raymarching is challenging. Most approaches either look flat or require expensive 3D calculations. This React component uses advanced bump mapping, gradient noise fields, and sophisticated lighting to create realistic pyramid textures with animated offset tips that run smoothly at 60fps.
Dimensional pyramid textures
Beautiful animated pyramid patterns with bump-mapped lighting and noise-driven geometric displacement:
Created by Shane in 2020-06-29
Built for React applications with TypeScript and Next.js in mind. The animation runs entirely on the GPU using WebGL with 2D gradient noise, bump mapping calculations, and dynamic lighting systems. Works seamlessly with shadcn/ui design systems.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/pyramid-pattern-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/pyramid-pattern-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/pyramid-pattern-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/pyramid-pattern-shaders.json
Usage
import { PyramidPatternShaders } from "@/components/ui/pyramid-pattern-shaders";
export default function Hero() {
return (
<PyramidPatternShaders>
<div className="relative z-10">
<h1>Your content here</h1>
</div>
</PyramidPatternShaders>
);
}
Why most pattern implementations fail
Most developers try to create pyramid patterns using simple height maps or basic 3D geometry. Wrong approach. You lose the sharp geometric definition and realistic lighting that makes patterns convincing. Traditional bump mapping often looks flat, and procedural patterns without proper noise distribution appear artificial and repetitive.
This React component uses gradient noise-driven offset calculations with advanced bump mapping and edge detection. The GPU handles everything using optimized 2D distance fields with directional lighting, specular reflections, and texture overlay systems. No raymarching overhead, no flat appearance, just dimensional geometric patterns at 60fps.
Features
- Zero raymarching overhead - Pure 2D calculations with bump mapping for 3D appearance
- Gradient noise-driven offsets using multi-octave noise for natural pyramid tip displacement
- Advanced bump mapping with edge detection and normal calculation for realistic lighting
- Dynamic lighting system with animated light sources, specular highlights, and Fresnel effects
- TypeScript definitions for proper IDE support in React projects
- Customizable parameters with 6 props for complete pattern control
- Performance optimization through efficient GPU-based 2D operations
- shadcn/ui compatible for consistent design systems
- Responsive design with automatic canvas resizing and resolution scaling
API Reference
PyramidPatternShaders
Main container component for the pyramid pattern effect.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Animation speed multiplier (0.1 to 3.0) |
scale | number | 1.0 | Pattern scale factor (0.5 to 3.0) |
offsetRows | number | 1 | Offset alternate rows (0: Off, 1: On) |
bumpStrength | number | 1.0 | Bump mapping intensity (0.0 to 3.0) |
hatchIntensity | number | 1.0 | Texture overlay strength (0.0 to 2.0) |
lightMovement | number | 1.0 | Light animation speed (0.0 to 3.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | All standard div props |
Common gotchas
Pattern appears flat: Increase bumpStrength
to enhance the bump mapping effect. The 3D appearance relies on proper normal calculations and gradient-based lighting.
Performance issues on mobile: Gradient noise calculations and bump mapping are GPU-intensive. Reduce scale
and bumpStrength
for better mobile performance.
Animation too fast/slow: Adjust both speed
for pattern movement and lightMovement
for lighting animation. They can be controlled independently for different visual effects.
Grid lines visible: Enable offsetRows
to create a brick-like offset pattern that breaks up regular grid artifacts and creates more natural distribution.
Texture too busy: Reduce hatchIntensity
to tone down the diagonal texture overlay. Setting to 0 removes the hatch pattern entirely for cleaner geometric appearance.
You might also like
Explore other shader-based background components for React applications:
2D Noise Contours
Smooth fractal contour lines with numerical gradients
Mandelbrot Patterns
Decorated Mandelbrot fractal with complex pattern overlays
Poincare Disc Animation
Animated hyperbolic Poincare disc tiling with CSG polygons
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
Smooth Voronoi Contours
Voronoi cellular patterns with smooth contour lines
Questions developers actually ask
React Poincare Disc Animation
Animated hyperbolic Poincare disc tiling with CSG polygons and geometric patterns. Pure WebGL hyperbolic geometry for React with TypeScript and shadcn/ui—mathematical visualization meets performance.
React Random Grid Subdivision
Fractal-like polygonal patterns with CSG operations on randomly subdivided grids. Pure WebGL grid subdivision for React with TypeScript and shadcn/ui—fractal complexity meets performance.