Join our Discord Community

React Sea Shaders

React 3D sea with GPU ocean simulation. Realistic ocean waves for Next.js with TypeScript and shadcn/ui—free code.

Building ocean effects?

Join our Discord community for help from other developers working with GPU ocean simulation and 3D sea effects.


Need realistic 3D ocean views without complex 3D engines? Most developers use flat water textures or heavy geometry that tanks performance. This React sea component uses GPU ray marching to create immersive 3D ocean scenes with rolling waves, atmospheric perspective, and dynamic camera movement.

Copy-paste TypeScript component that creates breathtaking ocean vistas with mathematical wave simulation and realistic lighting. Ray marching creates infinite ocean depth with proper horizon perspective. Built for Next.js applications with shadcn/ui design system. GPU-accelerated—cinematic ocean rendering.

React 3D sea with GPU ray marching

Infinite ocean with rolling waves, atmospheric perspective, and dynamic lighting:

Loading component...

Original shader by Dov Azencot

Perfect for React 19, Next.js 15, and modern TypeScript projects. 3D ocean rendered entirely on GPU using GLSL ray marching with wave mathematics. Customizable speed, wave height, frequency, perspective, and atmospheric effects. Full shadcn/ui compatibility with Tailwind CSS styling.

Installation

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

Usage

import { SeaShaders } from "@/components/ui/sea-shaders";

export default function OceanView() {
  return (
    <SeaShaders
      speed={0.8}
      waveHeight={1.2}
      waveFrequency={1.0}
      perspective={1.0}
      atmosphere={0.9}
    >
      <div className="relative z-10">
        <h1>Content over ocean</h1>
      </div>
    </SeaShaders>
  );
}

Why 3D ocean animations struggle with performance

Three.js ocean meshes are complex and heavy. Water plane geometry requires massive vertex counts. Most libraries use flat surfaces that lack proper wave mathematics and atmospheric depth perspective.

GPU ray marching solves this with mathematical ocean simulation. No mesh geometry needed—pure math defines infinite ocean surfaces. Ray marching finds wave intersections in real-time. Atmospheric perspective creates realistic horizon depth without polygons.

This React sea component uses GLSL mathematics for authentic ocean behavior. Multiple wave frequencies create realistic sea states. Dynamic camera movement with orbital motion. Fresnel reflections and atmospheric fog create cinematic ocean scenes.

React sea shader features

  • GPU ray marching - Mathematical 3D ocean without mesh geometry or vertices
  • Infinite ocean depth - Endless horizon with proper perspective and atmospheric haze
  • Realistic wave mathematics - Multiple frequency layers create natural ocean patterns
  • Dynamic camera movement - Orbital camera motion with smooth perspective changes
  • Atmospheric perspective - Distance fog and haze create realistic depth perception
  • Fresnel reflections - Physics-based sky reflection varying with viewing angle
  • Wave foam effects - White foam appears on wave crests for surface detail
  • Sky gradient system - Realistic sky colors with cloud patterns and sun glow
  • Specular highlights - Sun reflections on water surface with proper lighting
  • Fractal wave detail - Six octaves of detail create 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
  • Cinematic rendering - Film-quality ocean scenes with mathematical precision

API Reference

SeaShaders

Main container component for the 3D ocean simulation effect.

PropTypeDefaultDescription
speednumber1.0Ocean wave and camera movement speed (0.1 to 3.0)
waveHeightnumber1.0Wave amplitude and height (0.3 to 3.0)
waveFrequencynumber1.0Wave density and frequency (0.5 to 2.0)
perspectivenumber1.0Camera height and viewing angle (0.2 to 3.0)
atmospherenumber1.0Atmospheric haze and fog intensity (0.2 to 2.0)
classNamestring-Additional Tailwind CSS classes
...propsHTMLAttributes<HTMLDivElement>-All standard div props

GPU sea troubleshooting

Ocean too flat: Increase waveHeight to 2.0+ for more dramatic waves. Ray marching creates realistic scaling that may appear subtle compared to flat graphics.

Waves too slow/fast: Adjust speed for natural ocean rhythm. 0.5 creates calm, peaceful seas. 1.5+ creates dynamic, active ocean movement.

Camera too low/high: Use perspective to control viewing angle. 0.5 creates low, dramatic viewpoint. 2.0+ creates elevated, panoramic ocean views.

Too much haze: Lower atmosphere to 0.5 for clearer distant views. Higher values create misty, atmospheric ocean scenes with limited visibility.

Waves too dense/sparse: Adjust waveFrequency for different sea states. 0.7 creates long, rolling swells. 1.5+ creates choppy, detailed wave patterns.

Mobile performance issues: GPU ray marching is intensive. Lower ray steps and reduce waveHeight to 0.8 on mobile devices for smoother performance.

GPU compatibility: 3D ocean requires GPU for real-time ray marching calculation. Provide CSS ocean gradient fallbacks for older devices.

More React shader components

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

React 3D sea FAQ