shader-for-interfaces
Decide whether an interface effect should stay in CSS, SVG, or Canvas 2D or needs WebGL or WebGPU, then create, integrate, diagnose, and visually verify focused GPU effects inside product interfaces. Use for contained Three.js/WebGL2/GLSL or vgpu/WebGPU/WGSL surfaces, modest particles, GPU data views, and responsive canvases in TypeScript or React. Do not use for dependent passes, persistent simulations, formal render graphs, adaptive-quality systems, or renderer migrations.
v2space-labs · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add v2space-labs/shader-for-interfaces --skill shader-for-interfaces技能说明
name: shader-for-interfaces description: Decide whether an interface effect should stay in CSS, SVG, or Canvas 2D or needs WebGL or WebGPU, then create, integrate, diagnose, and visually verify focused GPU effects inside product interfaces. Use for contained Three.js/WebGL2/GLSL or vgpu/WebGPU/WGSL surfaces, modest particles, GPU data views, and responsive canvases in TypeScript or React. Do not use for dependent passes, persistent simulations, formal render graphs, adaptive-quality systems, or renderer migrations. license: MIT
Shader for Interfaces
Build the effect as part of the product. Keep content, controls, layout, and accessibility in the interface while the GPU supplies the visual layer.
Task mode
- Recommend: read effect-selection.md, compare the viable renderers, and return a decision, tradeoffs, fallback, and validation gaps. Do not change files unless asked.
- Diagnose: reproduce and isolate the failure. Explain the cause and a scoped fix; implement it only when the request includes fixing the issue.
- Build or change: follow the complete workflow, integrate the effect, and pass the browser gate.
Scope
For GPU implementation, this skill handles a focused, contained surface: one effect or draw, modest particles or data, and fixed quality caps chosen from measurement. It does not implement dependent render targets, ping-pong or feedback state, persistent GPU simulations, measured adaptive-quality controllers, formal render graphs, Three.js TSL/WebGPU migrations, or reusable delivery systems.
When a request crosses this boundary, name the features outside scope. Offer a contained simplification only when it still meets the user's goal; if it does not, return a system and acceptance outline and leave the advanced implementation undone. Never present a partial advanced system as complete.
Load only what the current decision or symptom needs:
| Symptom | Read |
|---|---|
| Renderer choice among CSS, SVG, Canvas 2D, WebGL, and WebGPU | effect-selection.md |
Blank, black, malformed, or non-compiling GLSL or ShaderMaterial | glsl-patterns.md |
| Vague visual idea, mood, or request without shader vocabulary | brief-to-effect.md |
| Resize, layering, pointer, alpha, or lifecycle failure | ui-integration.md |
| Low frame rate, leak, context loss, or fallback failure | performance-accessibility.md |
| Texture load, crop, edge, or distortion problem | textures-and-distortion.md |
| Particle count, bounds, update, or overdraw problem | particles.md |
| React Three Fiber ownership or frame-loop problem | r3f-integration.md |
| Blank or non-compiling WGSL, or a vgpu adapter, binding, surface, device, or headless-render problem | vgpu-wgsl.md |
| Incorrect or misleading data output | data-visualization.md |
| Generic or unmotivated palette, muddy gradient, or low contrast | color-direction.md |
Workflow for build and change tasks
- Inspect the project, target surface, existing renderer, installed Three.js, R3F, or vgpu versions, design tokens, interaction states, and device constraints. Resolve version-specific APIs from the target lockfile and installed documentation. Keep the current stack unless it blocks the requested result.
- Write a brief visual contract that names the effect's UI role, protected content, applicable component states, readiness condition, inputs, still composition, motion, target devices, fallback, and reduced-motion state. When the user starts from a mood or plain-language visual idea, read brief-to-effect.md and translate it without requiring shader vocabulary. Use color-direction.md to record the palette source, role map, and purpose of every gradient or glow before fixing color values.
- Choose the lightest renderer that can meet the contract. Read effect-selection.md before adding a GPU renderer to a project that does not already use one. For a contained vgpu/WGSL path, also read vgpu-wgsl.md. Apply the scope boundary above before implementation. When CSS, SVG, or Canvas 2D wins, keep the same contract discipline: name the first stable visual checkpoint, state what readiness and fallback mean for that renderer, and explicitly mark GPU-only compilation, context/device failure, and teardown checks as not applicable instead of silently omitting them.
- Build a no-post baseline. Verify geometry, coordinates, color, alpha, resize behavior, and one motion source before adding polish.
- Expose design-facing controls such as
intensity,scale,softness,turbulence,depth,contrast,motionSpeed,interactionRadius, anddataExaggeration. Give each public control a default, useful range, visible meaning, and a cost note when it changes GPU work. Keep raw shader constants out of the public control surface. - Integrate the canvas with ui-integration.md. Preserve clipping, stacking, input, responsive layout, DOM semantics, and cleanup.
- Use glsl-patterns.md while writing or adapting GLSL. Diagnose intermediate values before changing several parameters at once.
- Profile GPU and page-level outcomes, add fallbacks with performance-accessibility.md, then pass the browser checks below.
For data-driven work, read data-visualization.md before uploading buffers or textures. Define each source-to-visual mapping, including units, domain, missing values, legend, and a
阅读完整来源 ↗