when you quit the game, it basically crashes and the audio lags for now. changable audio is still not fixed, the child spatial_audio3d still plays too loud.
31 lines
No EOL
1.1 KiB
Text
31 lines
No EOL
1.1 KiB
Text
shader_type canvas_item;
|
|
|
|
// Reads the screen behind this object
|
|
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
|
|
|
// Set to (1.0, 0.0) for Horizontal pass, and (0.0, 1.0) for Vertical pass
|
|
uniform vec2 direction = vec2(1.0, 0.0);
|
|
|
|
// How far the blur spreads
|
|
uniform float size = 2.0;
|
|
|
|
void fragment() {
|
|
// FIX: Grab the exact texture dimensions from our screen sampler
|
|
vec2 pixel_size = 1.0 / vec2(textureSize(screen_texture, 0));
|
|
vec2 screen_uv = SCREEN_UV;
|
|
|
|
// Center pixel weight
|
|
vec4 color = texture(screen_texture, screen_uv) * 0.2270270270;
|
|
|
|
// First neighbor (using hardware filtering to sample 2 pixels at once)
|
|
vec2 offset1 = pixel_size * direction * 1.3846153846 * size;
|
|
color += texture(screen_texture, screen_uv + offset1) * 0.3162162162;
|
|
color += texture(screen_texture, screen_uv - offset1) * 0.3162162162;
|
|
|
|
// Second neighbor
|
|
vec2 offset2 = pixel_size * direction * 3.2307692308 * size;
|
|
color += texture(screen_texture, screen_uv + offset2) * 0.0702702703;
|
|
color += texture(screen_texture, screen_uv - offset2) * 0.0702702703;
|
|
|
|
COLOR = color;
|
|
} |