Join our Discord Community

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.

Powered by

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:

Loading component...

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.

PropTypeDefaultDescription
speednumber1.0Animation speed multiplier (0.1 to 3.0)
scalenumber1.0Pattern scale factor (0.5 to 3.0)
offsetRowsnumber1Offset alternate rows (0: Off, 1: On)
bumpStrengthnumber1.0Bump mapping intensity (0.0 to 3.0)
hatchIntensitynumber1.0Texture overlay strength (0.0 to 2.0)
lightMovementnumber1.0Light animation speed (0.0 to 3.0)
classNamestring-Additional Tailwind CSS classes
...propsHTMLAttributes<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:

Questions developers actually ask