init
This commit is contained in:
18
assets/shaders/bloom_up.frag
Normal file
18
assets/shaders/bloom_up.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user