Files
Vibe-HD-2D/assets/shaders/bloom_up.frag
Gabrieal Jimmy 2c99305fb0 init
2026-10-02 12:42:00 -05:00

19 lines
739 B
GLSL

#version 450 core
// 3x3 tent upsample, additively blended into the next larger mip.
in vec2 vUV;
layout(binding = 0) uniform sampler2D uSrc;
uniform vec2 uSrcTexel;
uniform float uRadius;
layout(location = 0) out vec4 fragColor;
void main() {
vec2 t = uSrcTexel * uRadius;
vec3 s = texture(uSrc, vUV).rgb * 4.0;
s += (texture(uSrc, vUV + vec2(-t.x, 0)).rgb + texture(uSrc, vUV + vec2(t.x, 0)).rgb +
texture(uSrc, vUV + vec2(0, -t.y)).rgb + texture(uSrc, vUV + vec2(0, t.y)).rgb) * 2.0;
s += texture(uSrc, vUV + vec2(-t.x, -t.y)).rgb + texture(uSrc, vUV + vec2(t.x, -t.y)).rgb +
texture(uSrc, vUV + vec2(-t.x, t.y)).rgb + texture(uSrc, vUV + vec2(t.x, t.y)).rgb;
fragColor = vec4(s / 16.0, 1.0);
}