Pixel budget controls
minPixelRatio (default: 2)
minPixelRatio sets the floor for the render scale. Even on a 1× display (where window.devicePixelRatio is 1), shaders render at 2× by default. This gives smoother edges and better antialiasing without requiring the user to be on a high-DPI screen.
Reduce minPixelRatio to 1 if you need to save GPU fill-rate on large canvases or on lower-end devices.
maxPixelCount (default: 8,294,400)
maxPixelCount caps the total number of physical pixels rendered, regardless of how large the canvas is on screen. The default is 1920 × 1080 × 4 — roughly a 4K screen’s worth of pixels.
When the canvas would exceed this limit, the shader is rendered at a lower resolution and upscaled by CSS. The canvas can still be any size in the DOM; it just loses quality beyond the cap rather than crashing the GPU.
Zero-cost static shaders
Setspeed={0} (or speed: 0 in the constructor) to render the shader once and stop. When speed is 0 the requestAnimationFrame loop is cancelled completely — the shader consumes no CPU or GPU time beyond the initial paint.
A shader with
speed={0} is as cheap as a static image after the first frame. Use it for decorative backgrounds, loading screens, or anything that doesn’t need to animate.Automatic tab pausing
ShaderMount listens to document.visibilitychange. When the browser tab is hidden, the animation loop is paused automatically. When the tab becomes visible again, it resumes from the same point. This requires no configuration and applies to all shaders.
Tree-shaking
The@paper-design/shaders package declares "sideEffects": false in its package.json. Bundlers (Vite, webpack, Rollup, etc.) can tree-shake unused exports, so only the shader modules you import end up in your bundle.
Browser support
Summary
| Concern | Default | How to tune |
|---|---|---|
| Antialiasing quality | minPixelRatio: 2 | Reduce to 1 for performance |
| Large canvas GPU cost | maxPixelCount: 8,294,400 | Reduce to 1920 * 1080 or lower |
| Recurring CPU/GPU cost | Animated by default | Set speed={0} for static shaders |
| Hidden-tab waste | Auto-paused | Nothing to configure |
| Bundle size | Tree-shakeable | Import only what you use |