Copy and paste the following code to overwrite everything in the shader:
shader_type canvas_item;
uniform float blur_radius : hint_range(0.0, 10.0); // blur strength
void fragment() {
vec2 size = vec2(textureSize(TEXTURE, 0));
vec2 uv = UV;
vec4 sum = vec4(0.0);
int blur_size = int(blur_radius);
for (int x = -blur_size; x <= blur_size; x++) {
for (int y = -blur_size; y <= blur_size; y++) {
vec2 offset = vec2(float(x), float(y)) / size;
sum += texture(TEXTURE, uv + offset);
}
}
float samples = pow(float(blur_size * 2 + 1), 2.0);
COLOR = sum / samples;
}
In the Material > Shader Parameters, you’ll now see a new parameter called Blur Radius. Adjust the value to see the background become blurry.
![image|432x459]
For Those Who Say “I Can’t Write Scripts!”
Godot uses its own shading language called GDSL, and shaders must be written in code.
However, many creators have already made a wide variety of shaders. You might find one that suits your needs by searching online or visiting sites like:
The blur_radius shader parameter can also be animated using the AnimationPlayer.
This makes it very easy to create animated effects using shaders—great for teleportation effects, battle transitions, and more.
This concludes the Visual Effects Course.
If you’re interested in other tutorials:
1. Graphics Course
For those who want to animate their own original characters.
2. Scripting Course
For those who are fine using default characters but want to build various mechanics and systems.