godot-shaders-basics▌
thedivergentai/gd-agentic-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Fragment/vertex shaders, uniforms, and built-in variables define custom visual effects.
Shader Basics
Fragment/vertex shaders, uniforms, and built-in variables define custom visual effects.
Available Scripts
vfx_port_shader.gdshader
Expert shader template with parameter validation and common effect patterns.
shader_parameter_animator.gd
Runtime shader uniform animation without AnimationPlayer - for dynamic effects.
dissolve_scissor_expert.gdshader
High-performance mask-based dissolve. Uses ALPHA_SCISSOR to enable depth-prepass optimization and shadow casting.
instance_uniform_hitflash.gdshader
Batch-friendly hit effects. Uses instance uniform to allow thousands of unique flashes in one draw call.
screenspace_hex_pixelate.gdshader
Post-processing logic for stylizing screen output. Uses hint_screen_texture and optimized coordinate quantization.
noise_terrain_displacement.gdshader
Procedural geometry displacement using NoiseTexture2D in the vertex() function for rolling terrain.
foliage_wind_sway_expert.gdshader
GPU-driven wind animation using world_vertex_coords for uniform sway across the environment.
global_grass_flatten.gdshader
World-interaction pattern using global uniform. Synchronizes player position to push grass down project-wide.
depth_world_reconstruction.gdshader
Expert depth-buffer logic. Reconstructs world-space coordinates from hint_depth_texture for water/fog effects.
triplanar_world_mapping.gdshader
UV-less texturing architecture. Seamlessly projects textures along world axes for procedural cliffs and rocks.
instance_texture_array.gdshader
Bypassing batching limits. Combines sampler2DArray with instance uniform to give unique textures to thousands of batched objects.
screenspace_full_quad.gdshader
Godot 4.3 specific full-rect shader. Handles Reversed-Z coordinate reconstruction to prevent clipping at the near plane.
NEVER Do in Shaders
- NEVER use
discardunconditionally for optimization — It prevents the depth prepass from working effectively. A discarded pixel still costs vertex processing; sometimes not rendering the object is better [1]. - NEVER use
if/elsefor dynamic states in high-performance shaders — GPUs hate branching. Usemix(),step(), andsmoothstep()for mathematical, hardware-optimized selection [5, 21]. - NEVER compare floats exactly — Hardware precision varies;
if (v == 0.5)is unreliable. Useabs(a - b) < epsilonorstep(). - NEVER use standard Alpha Blending for massive foliage — It prevents shadows and SSR. Use Alpha Scissor or Alpha Hash (dithering) to enable depth prepass and shadow casting [7].
- NEVER hardcode
POSITIONtovec4(VERTEX, 1.0)for full-screen quads in 4.3+ — Godot 4.3 uses Reversed-Z depth; this will cause clipping. UsePOSITION = vec4(VERTEX.xy, 1.0, 1.0)[8, 9]. - NEVER duplicate materials to change one color/value on many enemies — Use
instance uniform. This allows unique values for thousands of nodes while maintaining a single draw call (batching) [10]. - NEVER use
TIMEwithout a speed multiplier — Fragment speed should be controllable via uniforms to ensure consistency across different gameplay states. - NEVER forget
hint_source_colorfor color uniforms — Without it, the engine treats colors as linear math, leading to incorrect gamma and washed-out visuals in the inspector. - NEVER calculate complex math in
fragment()that could be invertex()—vertex()runs once per point;fragment()runs millions of times per frame. Interpolate values viavaryinginstead. - NEVER use
#definemacros for dynamic runtime toggles — These create new shader permutations, causing massive compilation stutters when first encountered in-game. Use uniforms instead. - NEVER forget to normalize vectors — Using
reflect(dir, normal)on unnormalized vectors causes severe rendering artifacts and incorrect lighting math. - NEVER modify UV without bounds checking or
fract()— Shifting UVs beyond 0.0-1.0 withoutrepeatwrapping or clamping will sample edge pixels or return black, breaking texture consistency.
shader_type canvas_item;
void fragment() {
// Get texture color
vec4 tex_color = texture(TEXTURE, UV);
// Tint red
COLOR = tex_color * vec4(1.0, 0.5, 0.5, 1.0);
}
Apply to Sprite:
- Select Sprite2D node
- Material → New ShaderMaterial
- Shader → New Shader
- Paste code
Common 2D Effects
Dissolve Effect
shader_type canvas_item;
uniform float dissolve_amount : hint_range(0.0, 1.0) = 0.0;
uniform sampler2D noise_texture;
void fragment() {
vec4 tex_color = texture(TEXTURE, UV);
float noise = texture(noise_texture, UV).r;
if (noise < dissolve_amount) {
discard; // Make pixel transparent
}
COLOR = tex_color;
}
Wave Distortion
shader_type canvas_item;
uniform float wave_speed = 2.0;
uniform float wave_amount = 0.05;
void fragment() {
vec2 uv = UV;
uv.x += sin(uv.y * 10.0 + TIME * wave_speed) * wave_amount;
COLOR = texture(TEXTURE, uv);
}
Outline
shader_type canvas_item;
uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
uniform float outline_width = 2.0;
void fragment() {
vec4 col = texture(TEXTURE, UV);
vec2 pixel_size = TEXTURE_PIXEL_SIZE * outline_width;
float alpha = col.a;
alpha = max(alpha, texture(TEXTURE, UV + vec2(pixel_size.x, 0.0)).a);
alpha = max(alpha, texture(TEXTURE, UV + vec2(-pixel_size.x, 0.0)).a);
alpha = max(alpha, texture(TEXTURE, UV + vec2(0.0, pixel_size.y)).a);
alpha = max(alpha, texture(TEXTURE, UV + vec2(0.0, -pixel_size.y)).a);
COLOR = mix(outline_color, col, col.a);
COLOR.a = alpha;
}
3D Shaders
Basic 3D Shader
shader_type spatial;
void fragment() {
ALBEDO = vec3(1.0, 0.0, 0.0); // Red material
}
Toon Shading (Cel-Shading)
shader_type spatial;
uniform vec3 base_color : source_color = vec3(1.0);
uniform int color_steps = 3;
void light() {
float NdotL = dot(NORMAL, LIGHT);
float stepped = floor(NdotL * float(color_steps)) / float(color_steps);
DIFFUSE_LIGHT = base_color * stepped;
}
Screen-Space Effects
Vignette
shader_type canvas_item;
uniform float vignette_strength = 0.5;
void fragment() {
vec4 color = texture(TEXTURE, UV);
// Distance from center
vec2 center = vec2(0.5, 0.5);
float dist = distancehow to use godot-shaders-basicsHow to use godot-shaders-basics on Cursor
AI-first code editor with Composer
1Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add godot-shaders-basics
2Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
$npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-shaders-basicsThe skills CLI fetches godot-shaders-basics from GitHub repository thedivergentai/gd-agentic-skills and configures it for Cursor.
3Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
◆ Which agents do you want to install to?││ ── Universal (.agents/skills) ── always included ────│ • Amp│ • Antigravity│ • Cline│ • Codex│ ●Cursor(selected)│ • Cursor│ • Windsurf4Verify installation
Confirm successful installation by checking the skill directory location:
.cursor/skills/godot-shaders-basicsReload or restart Cursor to activate godot-shaders-basics. Access the skill through slash commands (e.g., /godot-shaders-basics) or your agent's skill management interface.
⚠Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
Additional Resources
List & Monetize Your Skill
Submit your Claude Code skill and start earning
GET_STARTED →Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
✓Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
✓Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
✓Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
general reviewsRatings
4.7★★★★★44 reviews- ★★★★★Xiao White· Dec 28, 2024
godot-shaders-basics reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Ganesh Mohane· Dec 20, 2024
Solid pick for teams standardizing on skills: godot-shaders-basics is focused, and the summary matches what you get after install.
- ★★★★★Anaya Li· Dec 8, 2024
We added godot-shaders-basics from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Henry Desai· Nov 27, 2024
Solid pick for teams standardizing on skills: godot-shaders-basics is focused, and the summary matches what you get after install.
- ★★★★★Aarav Huang· Nov 19, 2024
I recommend godot-shaders-basics for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Rahul Santra· Nov 11, 2024
We added godot-shaders-basics from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Michael Martinez· Nov 3, 2024
Keeps context tight: godot-shaders-basics is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Evelyn Bhatia· Oct 22, 2024
godot-shaders-basics is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Henry Shah· Oct 18, 2024
godot-shaders-basics has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Nikhil Haddad· Oct 10, 2024
Useful defaults in godot-shaders-basics — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 44
1 / 5