Join our Discord Community

React Water Shaders

React water with GPU surface simulation. Realistic water effects for Next.js with TypeScript and shadcn/ui—free code.

Building water effects?

Join our Discord community for help from other developers working with GPU water simulation and surface effects.


Need realistic water surfaces without complex 3D engines? Most developers use static blue backgrounds or simple wave animations that lack depth. This React water component uses GPU surface simulation to create convincing water with reflections, caustics, depth variation, and authentic surface details.

Copy-paste TypeScript component that creates immersive water surfaces with sky reflections and underwater light patterns. Fresnel physics create realistic reflection behavior. Built for Next.js applications with shadcn/ui design system. GPU-accelerated—photorealistic water simulation.

React water with GPU surface physics

Realistic water surface with reflections, caustics, depth, and authentic wave patterns:

Loading component...

Original shader by Dov Azencot

Perfect for React 19, Next.js 15, and modern TypeScript projects. Water surface rendered entirely on GPU using GLSL physics algorithms with normal mapping. Customizable speed, depth, clarity, waves, and reflection strength. Full shadcn/ui compatibility with Tailwind CSS styling.

Installation

npx shadcn@latest add https://www.shadcn.io/registry/water-shaders.json
npx shadcn@latest add https://www.shadcn.io/registry/water-shaders.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/water-shaders.json
bunx shadcn@latest add https://www.shadcn.io/registry/water-shaders.json

Usage

import { WaterShaders } from "@/components/ui/water-shaders";

export default function OceanBackground() {
  return (
    <WaterShaders
      speed={1.0}
      depth={1.2}
      clarity={0.8}
      waves={1.1}
      reflection={0.9}
    >
      <div className="relative z-10">
        <h1>Content over water</h1>
      </div>
    </WaterShaders>
  );
}

Why water animations struggle with realism

CSS waves can't simulate surface physics. Video backgrounds lack interactivity and proper perspective. Most libraries use simple blue tints that don't capture the complex optical properties of real water surfaces.

GPU surface simulation solves this with mathematical water physics. Normal mapping creates realistic surface details. Fresnel calculations determine reflection behavior. Caustics and light rays simulate underwater optics for authentic depth perception.

This React water component uses GLSL mathematics for realistic surface behavior. Multiple noise layers create natural wave patterns. Sky reflection with distortion mimics real water surfaces. Depth-based color variation and caustic patterns add authentic underwater atmosphere.

React water shader features

  • Surface normal mapping - Mathematical surface details create realistic water texture
  • Fresnel reflections - Physics-based reflection strength varies with viewing angle
  • Sky reflection distortion - Realistic sky mirroring with surface wave distortion
  • Caustic light patterns - Underwater light focusing effects like real water
  • Depth color variation - Shallow cyan transitions to deep blue-green
  • Underwater light rays - Moving light beam patterns simulate sunlight penetration
  • Surface foam effects - White foam appears at wave peaks and surface disturbances
  • Water clarity control - Adjustable transparency from crystal clear to murky
  • Edge depth shading - Darker edges enhance three-dimensional water appearance
  • Multiple wave layers - Six octaves of fractal detail for natural complexity
  • TypeScript React component - Full IDE support with prop definitions
  • Next.js compatible - Works with App Router and modern React patterns
  • shadcn/ui integration - Consistent with Tailwind CSS design systems
  • Copy-paste installation - No vendor lock-in, you own the shader code
  • Photorealistic rendering - Mathematical accuracy creates convincing water simulation

API Reference

WaterShaders

Main container component for the realistic water surface effect.

PropTypeDefaultDescription
speednumber1.0Water movement and wave speed (0.1 to 3.0)
depthnumber1.0Water depth variation (0.3 to 2.0)
claritynumber1.0Water transparency level (0.2 to 1.0)
wavesnumber1.0Wave intensity and detail (0.5 to 2.0)
reflectionnumber1.0Sky reflection strength (0.0 to 2.0)
classNamestring-Additional Tailwind CSS classes
...propsHTMLAttributes<HTMLDivElement>-All standard div props

GPU water troubleshooting

Water too dark: Increase clarity to 1.0 for crystal clear water. Lower values create murky, deep water effects. Adjust reflection for brighter surface appearance.

Waves too calm/chaotic: Use waves to control surface activity. 0.7 creates gentle, calm water. 1.5+ creates active, choppy water with detailed surface texture.

No reflections visible: Increase reflection to 1.5+ for stronger sky mirroring. Fresnel physics make reflections stronger at shallow viewing angles.

Movement too slow/fast: Adjust speed for natural water flow. 0.5 creates peaceful, slow-moving water. 2.0+ creates rapid, dynamic water movement.

Water too shallow/deep: Use depth to control color variation. 0.5 creates shallow, cyan water. 1.5+ creates deep, dark blue ocean water.

Mobile performance issues: GPU water simulation is intensive. Lower waves to 0.8 and clarity to 0.8 on mobile devices for smoother performance.

GPU compatibility: Water effects require GPU for real-time surface calculation. Provide CSS blue gradient fallbacks for older devices without sufficient processing power.

More React shader components

Explore other GPU-accelerated shader components for Next.js applications:

React water effect FAQ