Shader Art Coding (GLSL / Shadertoy)
/shader-art-coding
A tested library of 186 GLSL building blocks plus a workflow for procedural fragment shaders: SDF raymarching, 2D distance fields, noise and fBm, terrain, water, clouds, lighting and tonemapping. A Python bundler inlines only the functions a shader uses, and a checker lints it for the mistakes that break WebGL. Good for game backdrops, title screens, portals, pickups and full-screen effects.
- 许可证
- MIT
- 出品
- GameSkill 出品
我们测过
在 WebGL2 (GLSL ES 3.00) in Chrome headless + glslang 16.6.0 上通过 43/43 项检查(2026-11-09):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。
测试报告这个 skill 做什么
什么时候触发
00): SDF raymarching, procedural buildings/cities, 2D distance-field graphics, noise / fBm / domain warping, terrain, ocean/coastal water optics, clouds and other volumes, PBR lighting, color and tonemapping. …
GameSkill 测过的版本
GameSkill 调优版:skill 文件取自提交 a56e7738d3f2,按我们的 skill 流程加上可运行示例、测试报告、自检清单和中文指南。
协议:基于 gokayfem/shader-skills(作者 gokayfem),协议 MIT。ZIP 保留协议文件(LICENSE),CHANGES.md 列出了 GameSkill 加的所有文件。

自检清单
- 先说清画面:主体、镜头、材质、光、动作 / State the image first: subject, camera, materials, light, motion
- 用 search 找库函数,按名字调用,不手抄 / Find library functions with search and call them by name; never paste them
- bundle 之后 check 必须 0 错误(装了 glslangValidator 就会编译) / After bundle, check reports 0 errors (and compiles when glslangValidator is installed)
- 不用 sin 哈希、gl_FragColor、#version 和自定义 uniform / No sine hash, gl_FragColor, #version line or custom uniforms
- 留 DEBUG_MODE 和顶部命名的美术参数,并真的渲染出来看 / Keep DEBUG_MODE and named art constants at the top, and actually render and look
- 说明是怎么编译检查的;只写原创画面,不复刻现有游戏 / Say how it was compile-checked; original scenes only, never a remake of an existing game
中文指南
这个 skill 做什么
教 agent 写程序化的 GLSL 片元着色器(Shadertoy 的 mainImage、WebGL2 / GLSL ES 3.00):SDF 光线步进、2D 距离场、噪声和 fBm、地形、水面、云、光照和色调映射。附一套测过的 GLSL 函数库(20 个文件、186 个函数,每个标明精确 / 下界 / 近似距离),一个只用 Python 标准库的工具:按关键词查函数、把着色器用到的函数打包成可直接粘贴的代码、检查 WebGL 常见错误(装了 glslangValidator 还会编译)。另有 11 个渲染验证过的模板和 14 篇参考说明。
什么时候用
- 网页游戏的动态标题画面、菜单背景、传送门、拾取物、天空和水面
- 着色器在一种显卡上正常、换一种就出错(sin 哈希、整数字面量、NaN)
- 把 Shadertoy 风格的效果搬进游戏,并带上调试视图和命名的美术参数
怎么装
下载本页的 ZIP,把 shader-art-coding/ 文件夹放进 agent 的 skills 文件夹:Claude Code 用 .claude/skills/,Codex、Gemini CLI、OpenCode 用 .agents/skills/,Cursor 用 .cursor/skills/,Copilot 用 .github/skills/,Windsurf 用 .windsurf/skills/,然后重启 agent。工具只需要 Python 3;想让检查同时编译,再装 glslangValidator(apt install glslang-tools 或 brew install glslang)。也可以直接对 agent 说:Install the skill from https://gameskill.dev/skills/shader-art-coding/install.md
最小示例
gameskill/examples/ 里是我们为一个原创洞穴探索游戏写的标题背景「晶环」:一圈发光的水晶环悬在流动的雾上,下面有星点闪烁。源文件只按名字调用库函数(fbm、sdCircle、sdStar、rot2、tonemapAgX、linearToSrgb、ditherTPDF 等),bundle 把它们内联成一个可粘贴的文件,再 check 通过。player.html 是十几行的 WebGL2 外壳,提供 iTime、iResolution、iFrame,任何网页游戏都能照抄。
我们怎么测的
- skill 自带的
check对整个库和模板 0 错误,并用 glslang 16.6.0 编译全部 186 个单元; - 我们的着色器打包后检查通过、编译通过,打包结果只含用到的函数;
- 在无界面 Chrome(WebGL2,SwiftShader)里编译并渲染全部 11 个模板和我们的着色器:无编译错误、画面不是纯色、没有 NaN 黑块,动画前后帧不同;DEBUG_MODE 视图能切换;
- 故意写进 sin 哈希、
gl_FragColor、#version、整数参与浮点运算,check都能报出来。
结果在 gameskill/test-report.json,截图是我们的「晶环」标题背景。
搭配
godot-shaders:Godot 自己的着色语言pixelfx:像素风特效做成 sprite sheetgame-trailer-from-code:把着色器背景录成宣传片
安装
告诉你的 AI
Install the skill from https://gameskill.dev/skills/shader-art-coding/install.md
GameSkill 测过的版本
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/shader-art-coding.zip -o /tmp/gameskill-shader-art-coding.zip
unzip -oq /tmp/gameskill-shader-art-coding.zip -d .claude/skills
rm /tmp/gameskill-shader-art-coding.zip包含内容
- A GLSL library of 186 functions in 20 files (hash, noise, sdf2d, sdf3d, operators, domain, raymarch, camera, shading, water, volume, color, tonemap, post…), each tagged exact, bound or approx
- scripts/glsl_tools.py: search the library, bundle a shader into paste-ready Shadertoy code, check it (lint + glslangValidator), rebuild the index
- 11 render-verified templates: raymarched SDF scene, terrain, ocean, coastal water, volumetric clouds, 2D poster, patterns, procedural city and more
- 14 reference notes, from subject routing and the colour pipeline to water, terrain and debugging
适合
- Animated title-screen and menu backdrops, portals, pickups, skies and water for web games
- Fixing a shader that compiles on one GPU and breaks on another (sine hashes, integer literals, NaNs)
- Porting a Shadertoy-style effect into a game, with debug views and named art controls
不适合
- HLSL, Unity ShaderLab or compute shaders
- Godot's own shading language: port the bundled GLSL by hand or see godot-shaders
- Pixel-art effects as sprite sheets: see pixelfx
试试这条提示词
Write an animated title-screen backdrop for my original cave-exploration game: a glowing crystal ring over drifting mist, WebGL2, with DEBUG views and named colour controls.关于这个 Skill
Shader Art Coding treats shader work as visual engineering: state the image, pick the smallest mathematical model that can make it (2D distance field, SDF raymarch, heightfield, volume), assemble it from a tested GLSL library by name, then bundle and check. The library has 186 functions across hashing, noise, 2D and 3D distance fields, operators, domain transforms, raymarching, cameras, shading, water, volumes, colour and tonemapping, each tagged with how exact its distance is. scripts/glsl_tools.py (Python 3 standard library) searches the library, bundles exactly the functions a shader uses into paste-ready Shadertoy code, and checks it for the mistakes that break WebGL: sine hashes, gl_FragColor, #version lines, custom uniforms, integer literals in float maths, NaN sources.
GameSkill's example is a title-screen backdrop for an original cave-exploration game, written against the library, bundled, checked, compiled with glslang and rendered in headless Chrome WebGL2 with a small player page any web game can reuse. We also compiled and rendered all 11 of the author's templates.
Related
- godot-shaders for Godot's own shading language.
- pixelfx for pixel-art effects exported as sprite sheets.
环境要求
- Python 3 standard library for the bundler and checker (no packages)
- glslangValidator (optional) so check also compiles the shader; without it the checker lints only
- A WebGL2 browser, Shadertoy, or an engine that takes a fragment shader to see the result
相关主题
常见问题
AI 2D 美术与序列帧管线 Sprite Asset Pipeline
把 AI 生成的原始视频直接变成商业级透明 2D 游戏序列帧:绿幕/溢色消除命令、0px 脚底锚点锁死排版、动作非线性重定时(4.33s → ~1.88s 含打击顿帧)与 Phaser / Godot 4 图集一键导出。
基于 gokayfem/shader-skills (作者 gokayfem,协议 MIT)。ZIP 里保留原作者的 LICENSE 和 NOTICE,ATTRIBUTION.md 和 CHANGES.md 写明来源提交和 GameSkill 加的内容。
搭配使用
作者标注的相关 Skills,或更适合相邻任务的 Skills。
Godot Shaders
Godot 4.7 shaders for 2D and 3D: vertex and fragment code, uniforms, TIME and UV animation, and screen-reading effects.
Shader Programming
Write game shaders from cross-engine fundamentals — the vertex→fragment pipeline, coordinate spaces, UV math, and common 2D/3D effects (tint, UV scroll, dissolve, outline, fresnel rim, vignette) in GLSL with HLSL equivalents.
pixelfx
244 pixel-art effects written as code (fire, explosions, magic, weather, UI, pickups, critters) plus a draft, render, look, refine loop for making new ones; every effect exports a sprite sheet with Aseprite-style JSON for Godot, Unity, Phaser or any engine.
rng-vfx
A game VFX skill for coding agents: six styles (anime, toon, stylized, dark fantasy, pixel, realism) for Unity VFX Graph, Unreal Niagara and three.js, with a live three.js stand to verify frame strips.
相似 skills
Codixel
A pixel-art skill built on one idea: the agent writes code, it is not a painter. It asks for a reference image, then removes the background, pixelates, rigs with bones and animates it in code with a 2,000-line toolkit (core/pixel.js), showing every step on a sheet before making game files.
open-game-skills
An MIT pack of about 190 SKILL.md agent skills for game design: combat feel, camera, traversal, world, validation, 2D/Spine and art pipeline, with a dispatcher and adapters for Three.js, PixiJS, Phaser, Cocos, Godot, Unity and Unreal.
Video to Sprite Sheet (AI clip to looping game sprites)
A GameSkill original that turns a short clip of one character on a plain background, such as an image-to-video result, into a game-ready sprite sheet: automatic key colour, despill, hard alpha, an automatically found seamless loop, one crop box for every frame so nothing jitters, bottom-centre anchor, fixed cells and an optional colour budget or palette. Exports PNG, JSON and a Godot 4 SpriteFrames .tres. Python 3 standard library plus ffmpeg.
Agent Sprite Forge
Five agent skills that turn one approved character still into a game-ready sprite set: one image-to-video clip per action, then deterministic Python tools key, register, loop, retime, palette-lock and export it for Godot, Aseprite and the web. Also maps, tiles and code-drawn art.