Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/paper-design/shaders/llms.txt

Use this file to discover all available pages before exploring further.

Water simulates a liquid surface over an input image using layered caustic noise and simplex waves. It can also run as a standalone animated texture without any image input, filling the canvas with an abstract rippling pattern.
When used as an image filter, the image prop is required. In React, pass a URL string and the component loads it automatically. In vanilla JS, pass a fully loaded HTMLImageElement to u_image. Without an image, the shader renders the caustic pattern over the colorBack color.

Usage

import { Water } from '@paper-design/shaders-react';

export default function Example() {
  return (
    <Water
      image="/my-photo.jpg"
      speed={1}
      size={1}
      caustic={0.1}
      waves={0.3}
      layering={0.5}
      highlights={0.07}
      edges={0.8}
      colorBack="#909090"
      colorHighlight="#ffffff"
      style={{ width: 600, height: 400 }}
    />
  );
}

Props

image
string (React) | HTMLImageElement (vanilla JS)
Optional source image to apply the water distortion to. In React, pass a URL string. In vanilla JS, pass a fully loaded HTMLImageElement as u_image. When omitted, the shader renders the caustic pattern over colorBack.
speed
number
default:"1"
Animation playback speed multiplier.
size
number
default:"1"
Pattern scale relative to the image. Range: 0.01 to 7.
caustic
number
default:"0.1"
Strength of the caustic distortion applied to the image UV coordinates. Range: 0 to 1.
waves
number
default:"0.3"
Additional distortion based on simplex noise, independent of the caustic layer. Range: 0 to 1.
layering
number
default:"0.5"
Strength of the second caustic distortion layer. Range: 0 to 1.
highlights
number
default:"0.07"
Amount of highlight color blended over the image following the caustic shape. Range: 0 to 1.
edges
number
default:"0.8"
Caustic distortion power applied at the image edges. Range: 0 to 1.
colorBack
string
default:"'#909090'"
Background color visible outside the image frame, or used as the base when no image is provided.
colorHighlight
string
default:"'#ffffff'"
Color of the caustic highlight overlay.

Presets

The following presets are exported from @paper-design/shaders-react:
ExportNameDescription
defaultPresetDefaultBalanced caustic distortion with subtle highlights
slowMoPresetSlow-moSlow, large caustic waves with visible highlights
abstractPresetAbstractHigh-scale, high-caustic standalone texture
streamingPresetStreamingFast moving wave distortion
import { waterPresets } from '@paper-design/shaders-react';