undefined is accepted as a convenience for server-side rendering, where some values (especially images) may not be available yet. The uniform is simply skipped rather than causing an error.
When an HTMLImageElement is passed, ShaderMount automatically uploads it as a WebGL texture and also sets a companion <uniformName>AspectRatio uniform (float) if that uniform exists in your shader.
Like ShaderPreset, but the image key is excluded from params. This is used for image-filter shaders (e.g. FlutedGlass, ImageDithering) where the image is controlled separately from the preset and shouldn’t change when switching between presets.
type ImageShaderPreset<T> = { name: string; params: Required<Omit<T, 'image'>>;};
An HTMLElement extended with a paperShaderMount property. This is the type of ShaderMount.parentElement and the type returned to a ref in the React component.
Every shader exported from @paper-design/shaders follows the same pattern: a <Name>Params interface for human-friendly prop values, and a <Name>Uniforms interface for the raw GLSL uniform values.
// Human-friendly params (what you write in your component props or config)interface MeshGradientParams extends ShaderSizingParams, ShaderMotionParams { colors?: string[]; // CSS color strings distortion?: number; swirl?: number; grainMixer?: number; grainOverlay?: number;}// Raw uniforms (what gets passed to ShaderMount)interface MeshGradientUniforms extends ShaderSizingUniforms { u_colors: vec4[]; // RGBA arrays in 0–1 range u_colorsCount: number; u_distortion: number; u_swirl: number; u_grainMixer: number; u_grainOverlay: number;}
The React component for each shader converts from Params to Uniforms internally — for example, calling getShaderColorFromString on each color string to produce a vec4.