How to Make Neat Blur Shader in Godot
Binbun shows how to use mipmaps.
Making a blur shader in Godot is not that hard, as proven by technical artist Binbun, who wrote a nice tutorial on the matter.
The creator explains that usually, more blur means less performance, but you won't have this issue in Godot because of mipmaps, a sequence of low-resolution versions of textures, which are used automatically in the engine.
To make the effect above, you'll need to create a ShaderMaterial and add it to the material slot of any Canvas Item. Then, the code is short, but if you want to dive deeper into the parameters, check out the whole tutorial.
shader_type canvas_item;
uniform float blur_amount : hint_range(0.0, 8.0) = 2.0;
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
void fragment() {
vec4 color = textureLod(screen_texture, SCREEN_UV, blur_amount);
COLOR = color;
}
Binbun has several other guides that will teach you things like toon shading, generating shapes using UV in Godot shaders, and more.
Don't forget to subscribe to our Newsletter and join our 80 Level Talent platform, follow us on Twitter, LinkedIn, Telegram, and Instagram, where we share breakdowns, the latest news, awesome artworks, and more.