19 lines
739 B
GLSL
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);
|
|
}
|