Untitled
Loading...
Searching...
No Matches
bloom_downscale.frag
Go to the documentation of this file.
1#version 460 core
2
3uniform sampler2D srcTexture;
4
7
8void main() {
9
10 vec2 srcTexelSize = 1.0 / vec2(textureSize(srcTexture, 0));
11 float x = srcTexelSize.x;
12 float y = srcTexelSize.y;
13
14
15 vec3 a = texture(srcTexture, vec2(vUV.x - 2.0 * x, vUV.y + 2.0 * y)).rgb;
16 vec3 b = texture(srcTexture, vec2(vUV.x, vUV.y + 2.0*y)).rgb;
17 vec3 c = texture(srcTexture, vec2(vUV.x + 2.0 * x, vUV.y + 2.0 * y)).rgb;
18
19 vec3 d = texture(srcTexture, vec2(vUV.x - 2.0 * x, vUV.y)).rgb;
20 vec3 e = texture(srcTexture, vec2(vUV.x, vUV.y)).rgb;
21 vec3 f = texture(srcTexture, vec2(vUV.x + 2.0 * x, vUV.y)).rgb;
22
23 vec3 g = texture(srcTexture, vec2(vUV.x - 2.0 * x, vUV.y - 2.0 * y)).rgb;
24 vec3 h = texture(srcTexture, vec2(vUV.x, vUV.y - 2.0*y)).rgb;
25 vec3 i = texture(srcTexture, vec2(vUV.x + 2.0 * x, vUV.y - 2.0 * y)).rgb;
26
27 vec3 j = texture(srcTexture, vec2(vUV.x - x, vUV.y + y)).rgb;
28 vec3 k = texture(srcTexture, vec2(vUV.x + x, vUV.y + y)).rgb;
29 vec3 l = texture(srcTexture, vec2(vUV.x - x, vUV.y - y)).rgb;
30 vec3 m = texture(srcTexture, vec2(vUV.x + x, vUV.y - y)).rgb;
31
32 vec3 downsample = e * 0.125;
33 downsample += (a + c + g + i) * 0.03125;
34 downsample += (b + d + f + h) * 0.0625;
35 downsample += (j + k + l + m) * 0.125;
36
37 fragColor = vec4(downsample, 1.0);
38}
void main()
out vec4 fragColor
Definition bloom.frag:6
uniform sampler2D srcTexture
in vec2 vUV
Definition lightmap.frag:13
float x
Definition types.h:11
float y
Definition types.h:11
Definition types.h:11
Definition types.h:12
Definition types.h:13