godot-shaders-vfx
Installation
SKILL.md
Shaders and VFX (4.7)
Validate after every edit: python scripts/shader_check.py [paths] compiles each .gdshader with the engine's shader compiler, headless, and returns {file, line, msg}. Errors inside #included .gdshaderinc files point at the include. Looks still need a real GPU, so ask the user to check them visually.
Shading language essentials
- The first line is
shader_type spatial | canvas_item | particles | sky | fog;. Entry points arevertex(),fragment(),light()(custom lighting) andstart()/process()(particles). render_mode(spatial):unshaded,cull_disabled,depth_draw_always,blend_add,diffuse_toon,specular_toon,world_vertex_coords, … An invalid mode is a compile error, so the checker catches it.- Uniform hints:
source_color(required on color and albedo textures, or colors come out wrong),hint_range(a, b, step),hint_normal,hint_default_white/black,filter_nearest,repeat_enable. Group them in the inspector withgroup_uniforms Name;…group_uniforms;. - Screen reads:
uniform sampler2D s : hint_screen_texture, filter_linear_mipmap;,hint_depth_textureandhint_normal_roughness_texture(Forward+). They replaceSCREEN_TEXTURE/DEPTH_TEXTUREfrom Godot 3. canvas_item screen reads need aBackBufferCopyonly when several effects stack. - Per-instance values without duplicating materials:
instance uniform float flash;set withset_instance_shader_parameter("flash", 1.0)(3D). Project-wide values:global uniform vec4 wind;declared in Project Settings → Shader Globals and set withRenderingServer.global_shader_parameter_set. varyingpasses data from vertex to fragment.#include "res://shaders/lib.gdshaderinc",#defineand#ifdefwork. Godot shaders are GLSL-like but not GLSL: there are noin/outglobals, and built-ins are UPPERCASE (ALBEDO,UV,VERTEX,NORMAL,TIME,SCREEN_UV,MODEL_MATRIX,INV_VIEW_MATRIX).- Stencil (4.5+):
stencil_mode write, compare_always, 1;on the mask material,stencil_mode read, compare_equal, 1;on the revealed one (portals, x-ray, outlines). StandardMaterial3D has ready-madeSTENCIL_MODE_OUTLINE/XRAYpresets. - Visual shaders are for artists. When writing shaders as an agent, use text
.gdshaderfiles: they're diffable and checkable.