I want to blur the background when a ui window is open.
In 3.x you can apply this simple shader to a ColorRect and done but this does not work in 4.0
The shader works but it only blurs the ui or blurs nothing, depending on the z index. It looks like SCREEN_TEXTURE never returns the actual texture I want (the 3D scene).
Its probably just something that is now different in 4.0 but I dont know what.
Godot 4.0 UI blur background
For some reasons the alpha of SCREEN_TEXTURE was 0 and that was the reason why the background blur didnt worked.
Changing it to 255 solved the "problem" (?) for me.
Is this expected?
9 months later
Oh my, you're right, this solved it for me too! Thank you!
This is my simple shader now:
shader_type canvas_item;
uniform float lod: hint_range(0.0, 5.0) = 0.0;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear_mipmap;
void fragment() {
vec4 color = texture(SCREEN_TEXTURE, SCREEN_UV, lod);
COLOR = vec4(color.rgb, 1.0);
}
3 months later
However still not working on the web tho. even if the alpha is set to 1.0, you will only get a black screen, I'm having this issue