Paper Shader

Paper Shaders WebGL2 canvas. Pass a fragment shader and uniforms; the mount compiles, resizes, and ticks time.

22 KB
•
Updated on September 3, 2026
Active on Canvas Stage

The canvas is registry/components/shader/paper-shader/index.tsx (default export PaperShader). The demo fragment lives in demo/components/shader/paper-shader/c-paper-shader-1/shader-source.tsx.

Installation

Bash
pnpm dlx shadcn@latest add @spaceui/components-shader-paper-shader

Usage

Code
import PaperShader from '@/components/shader/paper-shader'

export default function SpaceUI() {
  return (
    <PaperShader
      fragmentShader={shader}
      uniforms={{
        u_colorBack: [0.1, 0.1, 0.1, 1],
        u_colorTint: [1, 1, 1, 1],
        u_contour: 0.5,
        u_distortion: 0.1,
        u_softness: 0.05,
        u_speed: 1,
      }}
      speed={1}
      webGlContextAttributes={{ alpha: true, antialias: true }}
    />
  )
}

Files

FileRole
paper-shader/index.tsxWebGL2 mount, compile, uniforms, dispose
c-paper-shader-1/index.tsxDemo wrapper
c-paper-shader-1/shader-source.tsxExample GLSL 300 es fragment

API Reference

PropTypeDefaultDescription
fragmentShader
string
requiredGLSL 300 es fragment source
uniforms
Record<string, unknown>
{}Values uploaded each frame (u_time is injected)
speed
number
0Time multiplier
webGlContextAttributes
WebGLContextAttributes
—Context flags
minPixelRatio
number
—DPR floor
maxPixelCount
number
—Pixel cap for large canvases
style
CSSProperties
—Outer div style

The parent must be positioned; the canvas is absolute inset-0.

Keep in mind

  • MIT License: Free and open-source for personal and commercial use. Feel free to copy, tweak, and adapt the components to match your exact needs.
  • Credits & Inspiration: Some components on this site are inspired by or recreated from great ideas across the web. I'm not here to take credit; just to learn, experiment, and push interface craft further.
  • Reach out & Claims: If an attribution was missed, or if you have any inquiry or claim, feel free to reach out directly on X to @adrielzimbril. I'll be glad to update or resolve it right away.

Related Components

CloudShader

Interactive volumetric cloud material rendered as a full-bleed shader surface.

View
Fluid CrossfadeShader

A dual-pass WebGL shader fluid simulation with chromatic wave refraction and Bayer 4x4 matrix ordered dither crossfading.

View
Fluid Distortion ImageShader

An interactive WebGL shader image component with cover UV mapping and dynamic cursor fluid-distortion ripples using data textures.

View
Silk FlarePixel Reveal Image
pnpm dlx shadcn@latest add @spaceui/components-spaceui-ui
pnpm dlx shadcn@latest add @spaceui/components-shader-paper-shader