All skills

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.

Use this Skill: https://skilld.dev/gh/gamedev-skills/awesome-gamedev-agent-skills/godot-shaders

This session only. Nothing lands on disk.

referencesshading-language.md

≈998 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Godot Shading Language reference (Godot 4.7)

Depth companion to godot-shaders. The language is GLSL-like with engine built-ins.

Shader types and processor functions

shader_type Used by Main functions Key output writes
canvas_item 2D CanvasItem materials vertex, fragment, light COLOR
spatial 3D Mesh/surface materials vertex, fragment, light ALBEDO, EMISSION, ALPHA, ROUGHNESS, METALLIC, NORMAL_MAP
particles GPUParticles process start, process VELOCITY, TRANSFORM, COLOR
sky Sky material sky COLOR
fog FogVolume fog DENSITY, ALBEDO, EMISSION

Common built-ins

canvas_item: UV, COLOR, TEXTURE, TEXTURE_PIXEL_SIZE, SCREEN_UV, SCREEN_PIXEL_SIZE, VERTEX, TIME, POINT_COORD, MODELVIEW_MATRIX.

spatial: VERTEX (model/local), NORMAL, TANGENT, UV, UV2, VIEW, ALBEDO, ALPHA, EMISSION, ROUGHNESS, METALLIC, SPECULAR, NORMAL_MAP, TIME, CAMERA_POSITION_WORLD, MODEL_MATRIX, VIEW_MATRIX, PROJECTION_MATRIX, FRAGCOORD.

Uniform hints (4.x)

uniform float speed : hint_range(0.0, 1.0) = 0.5;
uniform float gain  : hint_range(0.0, 2.0, 0.01);     // min, max, step
uniform vec4 col    : source_color = vec4(1.0);       // sRGB color picker
uniform sampler2D tex : source_color, filter_linear_mipmap, repeat_enable;
uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap;
uniform sampler2D depth_tex  : hint_depth_texture;
uniform sampler2D normal_rough : hint_normal_roughness_texture;
group_uniforms Movement;                               // Inspector grouping
uniform float amplitude = 1.0;

Sampler filter/repeat qualifiers: filter_nearest, filter_linear, filter_nearest_mipmap, filter_linear_mipmap, repeat_enable, repeat_disable.

Set from code: material.set_shader_parameter("name", value); read with get_shader_parameter("name").

Render modes

First-line modifiers after the type, comma-separated:

  • spatial: unshaded, cull_disabled, cull_front, depth_draw_opaque, depth_test_disabled, blend_add, blend_mul, diffuse_toon, specular_toon, world_vertex_coords, vertex_lighting, shadows_disabled, ambient_light_disabled.
  • canvas_item: blend_mix (default), blend_add, blend_sub, blend_mul, blend_premul_alpha, unshaded, light_only.
shader_type spatial;
render_mode unshaded, cull_disabled;

varying (pass data vertex -> fragment)

varying vec3 world_pos;
void vertex()   { world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; }
void fragment() { ALBEDO = fract(world_pos); }

vertex() displacement

void vertex() {
    VERTEX.y += sin(VERTEX.x * 4.0 + TIME * 2.0) * 0.1;   // wave the mesh
}

Custom light() (toon ramp example, spatial)

void light() {
    float ndl = dot(NORMAL, LIGHT);
    float ramp = step(0.0, ndl);                 // hard two-tone
    DIFFUSE_LIGHT += ALBEDO * LIGHT_COLOR.rgb * ramp * ATTENUATION;
}

2D normal maps

For lit 2D, write NORMAL_MAP in a canvas_item fragment (or assign a normal map on the node) and add a Light2D/PointLight2D to the scene; light() controls the response.

Visual shaders

VisualShader lets you build the same graphs node-by-node and exports to this language. Useful for iteration; the generated code is standard Godot Shading Language. Convert to a text .gdshader when you need precise control or version it in source.

Performance notes

  • Texture fetches and discard are the most expensive common operations; minimize both.
  • Branch on uniforms (constant per draw) is cheap; branch on per-pixel values can be slow.
  • Precompute in vertex() and pass via varying when a value is linear across a triangle.
  • Prefer mix(), step(), smoothstep(), clamp() over if for per-pixel selection.

Source: SKILL.md on GitHub

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The godot-shaders skill is a technical guide for writing shaders in Godot 4.x. It contains safe, standard instructional content for game developers and does not exhibit any malicious patterns, network exfiltration, or dangerous execution capabilities.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 3727d02. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 days ago.

Activeupdated 2 months ago

README badge

README badge for gamedev-skills/awesome-gamedev-agent-skills/godot-shaders