glsl
БесплатноБез исполняемых скриптовНе проверенGLSL shader programming for JARVIS holographic effects
Об этом скилле
GLSL Shader Programming Skill
File Organization: This skill uses split structure. See
references/for advanced shader patterns.
1. Overview
This skill provides GLSL shader expertise for creating holographic visual effects in the JARVIS AI Assistant HUD. It focuses on efficient GPU programming for real-time rendering.
Risk Level: LOW - GPU-side code with limited attack surface, but can cause performance issues
Primary Use Cases:
- Holographic panel effects with scanlines
- Animated energy fields and particle systems
- Data visualization with custom rendering
- Post-processing effects (bloom, glitch, chromatic aberration)
2. Core Responsibilities
2.1 Fundamental Principles
- TDD First: Write visual regression tests and shader unit tests before implementation
- Performance Aware: Profile GPU performance, optimize for 60 FPS target
- Precision Matters: Use appropriate precision qualifiers for performance
- Avoid Branching: Minimize conditionals in shaders for GPU efficiency
- Optimize Math: Use built-in functions, avoid expensive operations
- Uniform Safety: Validate uniform inputs before sending to GPU
- Loop Bounds: Always use constant loop bounds to prevent GPU hangs
- Memory Access: Optimize texture lookups and varying interpolation
3. Implementation Workflow (TDD)
3.1 Step 1: Write Failing Test First
// tests/shaders/holographic-panel.test.ts
import { describe, it, expect, beforeEach } from 'vitest'
import { WebGLTestContext, captureFramebuffer, compareImages } from '../utils/webgl-test'
describe('HolographicPanelShader', () => {
let ctx: WebGLTestContext
beforeEach(() => {
ctx = new WebGLTestContext(256, 256)
})
// Unit test: Shader compiles
it('should compile without errors', () => {
const shader = ctx.compileShader(holoFragSource, ctx.gl.FRAGMENT_SHADER)
expect(shader).not.toBeNull()
expect(ctx.getShaderErrors()).toEqual([])
})
// Unit test: Uniforms are accessible
it('should have required uniforms', () => {
const program = ctx.createProgram(vertSource, holoFragSource)
expect(ctx.getUniformLocation(program, 'uTime')).not.toBeNull()
expect(ctx.getUniformLocation(program, 'uColor')).not.toBeNull()
expect(ctx.getUniformLocation(program, 'uOpacity')).not.toBeNull()
})
// Visual regression test
it('should render scanlines correctly', async () => {
ctx.renderShader(holoFragSource, { uTime: 0, uColor: [0, 0.5, 1], uOpacity: 1 })
const result = captureFramebuffer(ctx)
const baseline = await loadBaseline('holographic-scanlines.png')
expect(compareImages(result, baseline, { threshold: 0.01 })).toBeLessThan(0.01)
})
// Edge case test
it('should handle extreme UV values', () => {
const testCases = [
{ uv: [0, 0], expected: 'no crash' },
{ uv: [1, 1], expected: 'no crash' },
{ uv: [0.5, 0.5], expected: 'no crash' }
]
testCases.forEach(({ uv }) => {
expect(() => ctx.renderAtUV(holoFragSource, uv)).not.toThrow()
})
})
})
3.2 Step 2: Implement Minimum to Pass
// Start with minimal shader that passes tests
#version 300 es
precision highp float;
uniform float uTime;
uniform vec3 uColor;
uniform float uOpacity;
in vec2 vUv;
out vec4 fragColor;
void main() {
// Minimal implementation to pass compilation test
fragColor = vec4(uColor, uOpacity);
}
3.3 Step 3: Refactor with Full Implementation
// Expand to full implementation after tests pass
void main() {
vec2 uv = vUv;
float scanline = sin(uv.y * 100.0) * 0.1 + 0.9;
float pulse = sin(uTime * 2.0) * 0.1 + 0.9;
vec3 color = uColor * scanline * pulse;
fragColor = vec4(color, uOpacity);
}
3.4 Step 4: Run Full Verification
# Run all shader tests
npm run test:shaders
# Visual regression tests
npm run test:visual -- --update-snapshots # First time only
npm run test:visual
# Performance benchmark
npm run bench:shaders
# Cross-browser compilation check
npm run test:webgl-compat
4. Technology Stack & Versions
4.1 GLSL Versions
| Version | Context | Features |
|---|---|---|
| GLSL ES 3.00 | WebGL 2.0 | Modern features, better precision |
| GLSL ES 1.00 | WebGL 1.0 | Legacy support |
4.2 Shader Setup
#version 300 es
precision highp float;
precision highp int;
// WebGL 2.0 shader header
5. Performance Patterns
5.1 Avoid Branching - Use Mix/Step
// ❌ BAD - GPU branch divergence
vec3 getColor(float value) {
if (value < 0.3) {
return vec3(1.0, 0.0, 0.0); // Red
} else if (value < 0.7) {
return vec3(1.0, 1.0, 0.0); // Yellow
} else {
return vec3(0.0, 1.0, 0.0); // Green
}
}
// ✅ GOOD - Branchless with mix/step
vec3 getColor(float value) {
vec3 red = vec3(1.0, 0.0, 0.0);
vec3 yellow = vec3(1.0, 1.0, 0.0);
vec3 green = vec3(0.0, 1.0, 0.0);
vec3 color = mix(red, yellow, smoothstep(0.3, 0.31, value))
Установить glsl в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл glsl?
GLSL shader programming for JARVIS holographic effects
Как установить скилл glsl?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл glsl запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic