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 are vertex(), fragment(), light() (custom lighting) and start()/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 with group_uniforms Name; … group_uniforms;.
  • Screen reads: uniform sampler2D s : hint_screen_texture, filter_linear_mipmap;, hint_depth_texture and hint_normal_roughness_texture (Forward+). They replace SCREEN_TEXTURE/DEPTH_TEXTURE from Godot 3. canvas_item screen reads need a BackBufferCopy only when several effects stack.
  • Per-instance values without duplicating materials: instance uniform float flash; set with set_instance_shader_parameter("flash", 1.0) (3D). Project-wide values: global uniform vec4 wind; declared in Project Settings → Shader Globals and set with RenderingServer.global_shader_parameter_set.
  • varying passes data from vertex to fragment. #include "res://shaders/lib.gdshaderinc", #define and #ifdef work. Godot shaders are GLSL-like but not GLSL: there are no in/out globals, 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-made STENCIL_MODE_OUTLINE/XRAY presets.
  • Visual shaders are for artists. When writing shaders as an agent, use text .gdshader files: they're diffable and checkable.
Installs
12
GitHub Stars
54
First Seen
8 days ago