Quick answer: Use shader_type canvas_item for ColorRect shaders. Assign a ShaderMaterial resource (with the shader inside) to the rect’s Material slot, not a raw Shader.
Here is how to fix Godot 4 ColorRect that ignores its shader and renders as flat color. The shader type and material wrapper must match what canvas_item rendering expects.
The Symptom
You write a shader, drop it on the ColorRect material slot. The rect renders as plain color, ignoring the shader entirely.
What Causes This
Wrong shader_type. Spatial or particles shaders compile but cannot apply to canvas_item nodes.
Shader vs ShaderMaterial confusion. The Material slot wants a Material resource (ShaderMaterial), not the bare Shader resource.
use_parent_material on. Hides the rect’s own material in favor of the parent’s.
The Fix
Step 1: Use canvas_item shader type.
shader_type canvas_item;
void fragment() {
COLOR.rgb = vec3(sin(TIME), UV.x, UV.y);
}
Step 2: Wrap in ShaderMaterial. In Project view, right-click → New Resource → ShaderMaterial. Open it; drag your .gdshader into the Shader slot. Drag the ShaderMaterial into the ColorRect’s Material slot.
Step 3: For full-screen post-process.
shader_type canvas_item;
uniform sampler2D screen_tex : hint_screen_texture, repeat_disable, filter_nearest;
void fragment() {
vec4 col = texture(screen_tex, SCREEN_UV);
col.rgb = 1.0 - col.rgb; // invert
COLOR = col;
}
Add a ColorRect filling the viewport with this material. Set Mouse Filter to Ignore so it does not capture clicks.
Step 4: Confirm use_parent_material is off. ColorRect inspector → Material → Use Parent Material = false (unless intentionally sharing).
Step 5: Test in editor preview. Edit the rect’s color or shader uniforms; preview should update live. If not, the shader is not actually applied.
“canvas_item type. ShaderMaterial wrapper. use_parent_material off. ColorRect renders the shader.”
Related Issues
For shader uniform texture binding, see Shader Texture Hints. For shader color banding, see Shader Banding.
canvas_item, ShaderMaterial, no parent inherit. Pixel shader applies.