Shaders
shaderSimplify Godot GPU program creation with ready-made templates and compile-check validation. Assign parameters and save materials directly in the editor.
Instructions
Godot shaders (.gdshader): create from ready-made templates (dissolve, outline, hit flash, water, toon, hologram, pixelate, wave, scroll, vignette...) and assign them in one call, compile-check code with the engine's shader compiler (with line numbers and Godot 3 -> 4 migration hints), read/edit, list uniforms, set shader parameters on nodes, and save ShaderMaterials. Godot 4 syntax: 'source_color' (not hint_color), 'uniform sampler2D screen_texture : hint_screen_texture' (not SCREEN_TEXTURE).
Actions:
templates: {} templates per shader type.
create: {path: 'res://shaders/x.gdshader', type?: canvas_item|spatial|particles|sky|fog (inferred from assign_to / template / scene), template?='blank' (canvas_item: blank|dissolve|outline|flash|water|toon|hologram|pixelate|wave|scroll|vignette; spatial: blank|dissolve|outline|flash|water|toon|hologram|wave|scroll; particles|sky|fog: blank), code? (instead of a template; its shader_type wins, 'shader_type ;' is added if missing), assign_to?: node path (creates a ShaderMaterial on material / material_override / process_material / environment sky; the spatial 'outline' template goes into material_overlay so the object's own materials stay), overlay? (spatial: use material_overlay), next_pass? (spatial: chain after the current material instead), surface?, params?: {uniform: value}, material_path?: also save the ShaderMaterial as .tres, overwrite?} write + compile-check. Returns ok, diagnostics and uniforms.
validate: {path | code, type?} compile with Godot's shader compiler (first error with line) + lint (missing shader_type, unbalanced braces, Godot 3 names like hint_color/SCREEN_TEXTURE/WORLD_MATRIX). type is prepended when code lacks shader_type.
read: {path: .gdshader | ShaderMaterial .tres | node path} code, shader type and parsed uniforms.
edit: {path, edits: [{old, new, replace_all?}] | code} exact replacements (or full replacement) then re-validate; returns diagnostics.
uniforms: {path: .gdshader | material .tres | node path} uniforms with type, hint, default, range, group and current value (for materials).
set_param: {path: node path | ShaderMaterial .tres, param + value | params: {name: value}, material_index?} set shader parameters (coerced: '#hex' colors, [x,y,z] vectors, 'res://tex.png', {type: 'NoiseTexture2D', noise: {type: 'FastNoiseLite'}}). Undoable on nodes with embedded materials; a node whose ShaderMaterial is a shared .tres file edits and saves that file.
material: {path: 'res://materials/x.tres', shader: 'res://x.gdshader', params?: {uniform: value}, props?: {render_priority, next_pass}, assign_to?: node path, surface?, overwrite?} create a ShaderMaterial file, or update an existing one in place (keeps its other params; overwrite=true starts fresh). Optionally assign it to a node.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Shader source code. | |
| path | No | res:// .gdshader / .tres path, or node path (read/uniforms/set_param). | |
| type | No | Shader type: canvas_item | spatial | particles | sky | fog. | |
| edits | No | Exact replacements. | |
| param | No | One uniform name (set_param). | |
| props | No | Property map. Values are coerced to the property type: numbers, [x,y], 'Vector2(1,2)', '#ff8800', 'res://file', {"type":"RectangleShape2D","size":[32,32]} for new resources, enum names as strings. | |
| scene | No | res:// scene to operate on; opened in the editor if needed. Defaults to the currently edited scene. | |
| value | No | ||
| action | Yes | What to do. See the tool description for each action's parameters. | |
| params | No | Shader parameters {uniform: value}. | |
| shader | No | res:// .gdshader for a ShaderMaterial. | |
| overlay | No | shader.create: assign a spatial shader to the node's material_overlay. | |
| surface | No | Mesh surface index (spatial). | |
| template | No | Template name (see 'templates'). | |
| assign_to | No | Node path to put the new ShaderMaterial on. | |
| next_pass | No | shader.create: chain a spatial shader as next_pass of the node's current material. | |
| overwrite | No | Replace an existing file. | |
| material_path | No | Also save the created ShaderMaterial to this .tres. | |
| material_index | No | Which ShaderMaterial on the node when it has several (default: the one with those uniforms). |