React Sea Shaders
React 3D sea with GPU ocean simulation. Realistic ocean waves for Next.js with TypeScript and shadcn/ui—free code.
Powered by
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:
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.
Prop | Type | Default | Description |
---|---|---|---|
speed | number | 1.0 | Ocean wave and camera movement speed (0.1 to 3.0) |
waveHeight | number | 1.0 | Wave amplitude and height (0.3 to 3.0) |
waveFrequency | number | 1.0 | Wave density and frequency (0.5 to 2.0) |
perspective | number | 1.0 | Camera height and viewing angle (0.2 to 3.0) |
atmosphere | number | 1.0 | Atmospheric haze and fog intensity (0.2 to 2.0) |
className | string | - | Additional Tailwind CSS classes |
...props | HTMLAttributes<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:
Water Shaders
Realistic water surface with reflections, caustics, and depth variation
Fire Shaders
Realistic fire effects with organic flame movement and heat distortion
Gradient Mesh Shaders
Dynamic multi-point gradients with organic movement and smooth color transitions
Hologram Shaders
Sci-fi holographic effects with interference patterns and chromatic aberration
Plasma Shaders
Organic energy effects with flowing plasma patterns and smooth color cycling
Kaleidoscope Shaders
Dynamic animated kaleidoscope with rotating layers and wave synthesis
React 3D sea FAQ
Ripples in Black Shaders
Colorful plasma-style ripple effects with dynamic interference patterns. Three moving points create mesmerizing sine-based ripples with color transitions and psychedelic visuals.
React Sigmoids Sines Shaders
Psychedelic 2001 space odyssey effects with sigmoid functions and sine waves. Pure WebGL shaders for React with TypeScript and shadcn/ui—smooth GPU animations.