shader_type canvas_item;

// Cattura tutto quello che c'è sotto questo nodo
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;

uniform float blur_amount : hint_range(0.0, 5.0) = 2.5; 
uniform float focus_size : hint_range(0.0, 1.0) = 0.4;  
uniform float transition_softness : hint_range(0.01, 1.0) = 0.3; 

void fragment() {
    float dist_from_center = abs(SCREEN_UV.y - 0.5);
    float mask = smoothstep(focus_size / 2.0, (focus_size / 2.0) + transition_softness, dist_from_center);
    
    // Applica il blur
    vec4 blurred_screen = textureLod(screen_texture, SCREEN_UV, blur_amount * mask);
    COLOR = blurred_screen;
}