Simple Blur

A super simple blur effect.

 

Use lod variable to regulate strength.

Shader code
shader_type canvas_item;

uniform float lod: hint_range(0.0, 5) = 0.0;

void fragment(){
	vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV, lod);
	COLOR = color;
}
Live Preview
Tags
2d, blur, simple
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Comments 8

    1. Anything that will cover the whole screen, so usually a ColorRect for example. This is because the shader in a screen shader, meaning it will use SCREEN_TEXTURE and SCREEN_UV

      2
  1. how to do the same to a vec4 (like a shape made with code) instead of a texture?

    0
  2. For anyone getting an error in Godot 4, add this line above the fragment function to get it working: uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;

    9
    1. Alternatively, just swap SCREEN_TEXTURE and SCREEN_UV for TEXTURE and UV, respectively (I think, I could be wrong, feel free to correct me and explain why)

       

      Edit: Ok yeah, I was wrong, disregard 😁

      4
  3. DevNull

    Godot 4.x Version would be

    shader_type canvas_item;
    
    uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest_mipmap;
    uniform float lod: hint_range(0.0, 5) = 0.0;
    
    void fragment(){
        COLOR = textureLod(screen_texture, SCREEN_UV, lod);
    }
    
    10