godot-shaders
Ce qu’il fait
Apprend à l'agent à écrire du code de shader qui modifie l'apparence des éléments dans Godot, comme des bords lumineux ou des surfaces animées. Elle s'adresse aux artistes et développeurs qui ajoutent des effets visuels.
Quand l’utiliser
- ✓Quand vous voulez un effet visuel comme un contour, une dissolution ou un flash sur un sprite Godot.
- ✓Quand vous avez besoin d'un effet de surface 3D comme une lumière de bord, un rendu de dessin animé ou une texture en mouvement.
- ✓Quand vous convertissez un ancien shader Godot 3 vers la syntaxe de Godot 4.
Lien du skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-shaders/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Donne à mon sprite de personnage un flash blanc chaque fois qu'il est touché dans mon jeu Godot.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Elle montre comment écrire le programme du shader, l'attacher par un matériau, exposer des réglages que l'artiste peut modifier dans l'inspecteur et animer l'effet dans le temps.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Godot Shaders (4.x)
Write canvas_item (2D) and spatial (3D) shaders in the Godot Shading Language, animate
with TIME/UV, expose uniforms, and read the screen. Targets Godot 4.7.
When to use
- Use when writing
.gdshadercode or aShaderMaterial: 2D effects (outline, dissolve, flash, water), 3D surface shaders (rim light, toon, scrolling UV), or screen-space post effects.
When not to use: the cross-engine concepts of shading (UVs, vertex/fragment
theory) → shader-programming; particles/VFX nodes → general 3D; non-shader visuals.
Core workflow
- Pick the shader type on the first line:
shader_type canvas_item;for 2D (Sprite2D, TextureRect, anythingCanvasItem) orshader_type spatial;for 3D materials. (particles,sky,fogalso exist.) - Attach via a
ShaderMaterial. Create aShaderMaterial, assign your.gdshader, and put it on the node'smaterial. Uniforms appear in the Inspector. - Write
fragment()to set the output:COLOR(2D) orALBEDO/EMISSION/ALPHA(3D). Optionallyvertex()to move geometry andlight()for custom lighting. - Expose tunables as
uniforms with hints (source_color,hint_range) so they are editable and correctly color-managed. - Animate with the built-in
TIMEand sample textures withtexture(tex, UV). - Set uniforms from code with
material.set_shader_parameter("name", value).
Patterns
1. 2D (canvas_item): tint + scrolling UV
shader_type canvas_item;
uniform vec4 tint : source_color = vec4(1.0); // source_color = sRGB-correct color
uniform float scroll_speed : hint_range(0.0, 2.0) = 0.3;
void fragment() {
vec2 uv = UV;
uv.x += TIME * scroll_speed; // scroll horizontally over time
COLOR = texture(TEXTURE, uv) * tint; // TEXTURE = the node's texture
}
2. 2D dissolve using a noise threshold
shader_type canvas_item;
uniform sampler2D noise : repeat_enable; // a NoiseTexture2D
uniform float amount : hint_range(0.0, 1.0) = 0.0;
void fragment() {
vec4 tex = texture(TEXTURE, UV);
float n = texture(noise, UV).r;
if (n < amount) {
discard; // cut the pixel away
}
COLOR = tex;
}
3. 3D (spatial): emissive rim light
shader_type spatial;
uniform vec4 base_color : source_color = vec4(0.2, 0.5, 1.0, 1.0);
uniform vec3 rim_color : source_color = vec3(0.6, 0.8, 1.0);
uniform float rim_power : hint_range(0.5, 8.0) = 3.0;
void fragment() {
ALBEDO = base_color.rgb;
// VIEW and NORMAL are view-space built-ins; rim is strong at grazing angles.
float rim = pow(1.0 - dot(NORMAL, VIEW), rim_power);
EMISSION = rim_color * rim;
}
4. Screen-reading post effect (4.x hint, not SCREEN_TEXTURE)
shader_type canvas_item;
// 4.x: declare the screen as a uniform with hint_screen_texture.
uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap;
uniform float blur : hint_range(0.0, 4.0) = 1.0;
void fragment() {
vec2 px = SCREEN_PIXEL_SIZE * blur;
vec4 c = texture(screen_tex, SCREEN_UV);
c += texture(screen_tex, SCREEN_UV + vec2(px.x, 0.0));
c += texture(screen_tex, SCREEN_UV - vec2(px.x, 0.0));
COLOR = c / 3.0;
}
Set a uniform from GDScript:
$Sprite2D.material.set_shader_parameter("amount", 0.7)
Pitfalls
- 3.x → 4.x renames.
SCREEN_TEXTUREis removed — declareuniform sampler2D x : hint_screen_texture;and sample withSCREEN_UV. Color hintshint_color/hint_albedo→source_color;hint_white/hint_black→hint_default_white/hint_default_black;hint_rangestays. Depth/normal usehint_depth_texture/hint_normal_roughness_texture. - Wrong output variable. In
canvas_itemwriteCOLOR; inspatialwriteALBEDO(andEMISSION,ALPHA,ROUGHNESS,METALLIC). WritingCOLORin a spatial shader does nothing. - Color uniforms without
source_colorare treated as raw linear values and look wrong (washed/dark) because Godot won't sRGB-convert them. - Object drawn in the wrong order, casts no shadow, or skips SSAO (3D) → the spatial
shader reads or writes
ALPHA, which moves the whole material to the transparent pipeline even if the value is always1.0. Don't touchALPHAin opaque shaders; for hard cut-outs also setALPHA_SCISSOR_THRESHOLD(alpha-scissor stays in the opaque pass).
Questions fréquentes
Dois-je connaître le code des shaders ?
Une familiarité de base aide, mais la compétence explique les éléments de Godot étape par étape.
Concerne-t-elle la 2D ou la 3D ?
Les deux. La compétence couvre les shaders de canevas 2D et les shaders spatiaux 3D.
Couvre-t-elle les effets de particules ?
Pas vraiment. Les nœuds de particules sont un sujet distinct, cette compétence se concentre sur le code des shaders.
Détails
Description originale de l’auteur
Write Godot 4.7 shaders in the Godot Shading Language: canvas_item shaders for 2D and spatial shaders for 3D, with vertex/fragment functions, uniforms (source_color, hint_range), TIME/UV animation, and screen-reading via hint_screen_texture. Use when authoring .gdshader files, writing fragment/vertex code, making 2D/3D visual effects, or porting 3.x shaders (SCREEN_TEXTURE, hint_color) to 4.x.
Popularité
- Étoiles GitHub
- 6.6k
- Position au classement
- #13828
- Licence
- Apache-2.0
- Mis à jour
- 28/10/2026
Commentaires
- …
Autres skills de ce dépôt
router
6.6kAide votre agent à choisir la bonne compétence de développement de jeu pour une demande, en détectant votre moteur et le type de tâche.
ai-behavior-trees-utility-ai
6.6kAide votre agent à construire un arbre de comportement et une IA par utilité pour des ennemis qui choisissent leurs actions selon priorité et score.
audio-design
6.6kApprend à votre agent le mixage audio de jeu : bus, volume en décibels, baisse sous les dialogues, musique adaptative et variation des effets sonores.
camera-systems
6.6kAide votre agent à construire des caméras de jeu qui suivent en douceur, restent dans le niveau, et pivotent ou regardent autour en 3D.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.