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.

Fluted Glass is an image filter shader that distorts an input image through configurable ribbed or streaked patterns, simulating the look of fluted or textured glass. Grid shape, distortion profile, blur, edge softness, and grain are all individually adjustable.
This is an image filter shader — it requires an image input. In React, pass a URL string to the image prop and it is loaded automatically. In vanilla JS, pass a fully loaded HTMLImageElement to the u_image uniform.

Usage

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

export default function Example() {
  return (
    <FlutedGlass
      image="/my-photo.jpg"
      shape="lines"
      distortionShape="prism"
      size={0.5}
      distortion={0.5}
      shadows={0.25}
      highlights={0.1}
      blur={0}
      edges={0.25}
      colorBack="#00000000"
      colorShadow="#000000"
      colorHighlight="#ffffff"
      style={{ width: 600, height: 400 }}
    />
  );
}

Props

image
string (React) | HTMLImageElement (vanilla JS)
required
The source image to filter. In React, pass a URL string — the component loads it automatically. In vanilla JS, pass a fully loaded HTMLImageElement as u_image.
shape
GlassGridShape
default:"'lines'"
Shape of the repeating grid pattern. Use the GlassGridShapes enum (vanilla JS) or string literal (React).
ValueDescription
linesStraight parallel lines
linesIrregularOrganically varying lines
waveSinusoidal wave pattern
zigzagZigzag stripe pattern
patternCrosshatch pattern
distortionShape
GlassDistortionShape
default:"'prism'"
The profile of distortion applied within each stripe. Use the GlassDistortionShapes enum (vanilla JS) or string literal (React).
ValueDescription
prismPrism-like refraction
lensLens-shaped bulge
contourContour-following distortion
cascadeCascading waterfall-like flow
flatFlat, minimal distortion
size
number
default:"0.5"
Size of the distortion shape grid. Range: 0 to 1.
angle
number
default:"0"
Direction of the grid relative to the image, in degrees. Range: 0 to 180.
distortion
number
default:"0.5"
Power of distortion applied within each stripe. Range: 0 to 1.
shift
number
default:"0"
Texture shift in the direction opposite the grid. Range: -1 to 1.
stretch
number
default:"0"
Extra distortion along the grid lines. Range: 0 to 1.
blur
number
default:"0"
One-directional blur over the image and extra blur around edges. Range: 0 to 1.
edges
number
default:"0.25"
Glass distortion and softness on the image edges. Range: 0 to 1.
shadows
number
default:"0.25"
Color gradient added over the image and background, following the distortion shape. Range: 0 to 1.
highlights
number
default:"0.1"
Thin strokes rendered along the distortion shape, useful for anti-aliasing on small grids. Range: 0 to 1.
colorBack
string
default:"'#00000000'"
Background color as a CSS color string (including alpha). Visible outside the image frame.
colorShadow
string
default:"'#000000'"
Color of shadow gradients applied over the distortion pattern.
colorHighlight
string
default:"'#ffffff'"
Color of highlight strokes along the distortion edges.
margin
number
default:"0"
Shorthand to set all four margins simultaneously. Range: 0 to 1.
marginLeft
number
default:"0"
Distance from the left edge to the effect. Range: 0 to 1.
marginRight
number
default:"0"
Distance from the right edge to the effect. Range: 0 to 1.
marginTop
number
default:"0"
Distance from the top edge to the effect. Range: 0 to 1.
marginBottom
number
default:"0"
Distance from the bottom edge to the effect. Range: 0 to 1.
grainMixer
number
default:"0"
Strength of grain distortion applied to shape edges. Range: 0 to 1.
grainOverlay
number
default:"0"
Post-processing black/white grain overlay strength. Range: 0 to 1.

Presets

The following presets are exported from @paper-design/shaders-react:
ExportNameDescription
defaultPresetDefaultStraight lines with prism distortion
wavesPresetWavesWave grid with contour distortion and blur
abstractPresetAbstractIrregular lines at high scale and full blur
foldsPresetFoldsCascade distortion with margins giving a folded edge look
import { flutedGlassPresets } from '@paper-design/shaders-react';

Enums

Import GlassGridShapes and GlassDistortionShapes from @paper-design/shaders when using the vanilla JS API:
import { GlassGridShapes, GlassDistortionShapes } from '@paper-design/shaders';

// GlassGridShapes: lines | linesIrregular | wave | zigzag | pattern
// GlassDistortionShapes: prism | lens | contour | cascade | flat