Skip to content

Water Demo

Realistic water rendering featuring Gerstner wave simulation, Fresnel-based reflections, procedural foam, and underwater caustics.

  • Gerstner Waves - Realistic wave motion with circular particle paths
  • Fresnel Reflections - Angle-dependent reflectivity
  • Screen-Space Reflections - Real-time scene reflections
  • Underwater Caustics - Light patterns on submerged surfaces
  • Procedural Foam - Foam at wave peaks and shorelines
  • Depth-Based Coloring - Darker color in deeper areas
import { Canvas } from '@react-three/fiber';
import { AdvancedWater, ProceduralSky } from '@strata-game-library/core';
import { OrbitControls } from '@react-three/drei';
function WaterDemo() {
return (
<Canvas camera={{ position: [0, 20, 50], fov: 60 }}>
<ProceduralSky sunPosition={[100, 50, 100]} />
<ambientLight intensity={0.4} />
<directionalLight position={[50, 100, 50]} intensity={1} />
<AdvancedWater
size={500}
depth={30}
waveHeight={2}
reflections
caustics
foam
/>
<OrbitControls />
</Canvas>
);
}
ControlAction
Left Click + DragRotate camera
ScrollZoom in/out
UI SlidersAdjust water parameters
ParameterEffect
waveHeightHeight of waves
waveSpeedSpeed of wave animation
reflectionsEnable/disable reflections
causticsEnable/disable caustic patterns
foamEnable/disable wave foam
foamThresholdWave height for foam to appear
  • Reflections use a lower resolution render target
  • Caustics are calculated efficiently in the shader
  • Disable reflections on mobile for better performance
  • The demo adapts quality based on device capability