Files
novafarma/godot/assets/shaders/dreamy_blur.gdshader

43 lines
1.3 KiB
Plaintext

shader_type canvas_item;
// DREAMY BLUR SHADER - For intro flashbacks (parents, memories)
// Creates soft Gaussian blur with adjustable intensity
// Citation: 2026-01-10 - Intro Sequence
uniform float blur_amount : hint_range(0.0, 20.0) = 10.0;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
// Gaussian blur function
vec4 blur_texture(sampler2D tex, vec2 uv, vec2 pixel_size, float amount) {
vec4 color = vec4(0.0);
float total = 0.0;
// Kernel size based on blur amount
int samples = int(amount);
for (int x = -samples; x <= samples; x++) {
for (int y = -samples; y <= samples; y++) {
vec2 offset = vec2(float(x), float(y)) * pixel_size * 0.5;
float weight = exp(-0.5 * (float(x*x + y*y)) / (amount * amount));
color += texture(tex, uv + offset) * weight;
total += weight;
}
}
return color / total;
}
void fragment() {
vec2 pixel_size = 1.0 / vec2(textureSize(SCREEN_TEXTURE, 0));
if (blur_amount > 0.1) {
COLOR = blur_texture(SCREEN_TEXTURE, SCREEN_UV, pixel_size, blur_amount);
} else {
COLOR = texture(SCREEN_TEXTURE, SCREEN_UV);
}
// Slight brightness boost for "dreamy" feel
COLOR.rgb *= 1.1;
}