Features
- Multiple grid patterns (lines, waves, zigzag, patterns)
- Various distortion shapes (prism, lens, contour, cascade, flat)
- Configurable shadows and highlights
- One-directional blur effects
- Edge softness control
- Grain overlay options
Basic Usage
Parameters
Visual Parameters
string | HTMLImageElement
required
Source image to apply the fluted glass effect to
string
default:"'#00000000'"
Background color in hex, rgb, or rgba format
string
default:"'#000000'"
Shadow color for darker areas in hex, rgb, or rgba format
string
default:"'#ffffff'"
Highlight color for lighter areas in hex, rgb, or rgba format
number
default:"0.5"
Size of the distortion shape grid
'lines' | 'linesIrregular' | 'wave' | 'zigzag' | 'pattern'
default:"'lines'"
Grid shape pattern:
lines: Regular parallel lineslinesIrregular: Lines with irregular variationswave: Wavy patternzigzag: Zigzag patternpattern: Complex sine pattern
'prism' | 'lens' | 'contour' | 'cascade' | 'flat'
default:"'prism'"
Shape of distortion within each stripe:
prism: Sharp prismatic distortionlens: Lens-like curved distortioncontour: Contoured distortion with depthcascade: Cascading wave distortionflat: Minimal flat distortion
number
default:"0.5"
Power of distortion applied within each stripe
number
default:"0"
Direction of the grid relative to the image in degrees
number
default:"0.25"
Color gradient added over image, following distortion shape
number
default:"0.1"
Thin strokes along distortion shape, useful for antialiasing
number
default:"0"
One-directional blur over the image with extra blur around edges
number
default:"0.25"
Glass distortion and softness on the image edges
number
default:"0"
Texture shift in direction opposite to the grid
number
default:"0"
Extra distortion along the grid lines
number
default:"0"
Distance from all edges to the effect (applies to all sides)
number
default:"0"
Distance from the left edge to the effect
number
default:"0"
Distance from the right edge to the effect
number
default:"0"
Distance from the top edge to the effect
number
default:"0"
Distance from the bottom edge to the effect
number
default:"0"
Strength of grain distortion applied to shape edges
number
default:"0"
Post-processing black/white grain overlay
Sizing Parameters
'none' | 'contain' | 'cover'
default:"'cover'"
How to fit the shader into the canvas dimensions
number
default:"1"
Overall zoom level of the graphics
number
default:"0"
Overall rotation angle in degrees
number
default:"0"
Horizontal offset of the graphics center
number
default:"0"
Vertical offset of the graphics center
Animation Parameters
number
default:"0"
Animation speed multiplier (0 for static)
number
default:"0"
Manual frame control for animation
Presets
The FlutedGlass shader comes with several built-in presets:- Default: Classic fluted glass with prism distortion
- Abstract: Irregular lines with high blur and distortion
- Waves: Wave pattern with stretch and contour distortion
- Folds: Cascade distortion with margins
Examples
Wave Pattern
Abstract Effect
Subtle Folds
Technical Details
Shader Uniforms (Vanilla JS)
When using the vanilla JavaScript API:Grid Shapes
lines(1): Regular parallel lineslinesIrregular(2): Irregular line patternswave(3): Sine wave patternzigzag(4): Zigzag patternpattern(5): Complex 2D pattern
Distortion Shapes
prism(1): Sharp prismatic effectlens(2): Curved lens effectcontour(3): Depth contour effectcascade(4): Cascading wavesflat(5): Minimal distortion
Performance Notes
- Static shader (no animation by default)
- Blur parameter can impact performance at high values
- Grain effects are relatively lightweight
- Works best with high-resolution source images
