Untitled
Loading...
Searching...
No Matches
bloom.frag
Go to the documentation of this file.
1
2#version 430 core
3uniform sampler2D uScene;
4
7
8void main() {
9
10 vec4 sc = texture(uScene, vUV);
11 float brightness = max(max(sc.r, sc.g), sc.b);
12 float threshold = 1.0;
13 float knee = 0.2;
14
15
16 float rq = clamp(brightness - threshold + knee, 0.0, 2.0 * knee);
17 rq = (rq * rq) / (4.0 * knee);
18
19 float intensity = max(rq, brightness - threshold);
20
21 float multiplier = intensity / max(brightness, 0.0001);
22
23 fragColor = vec4(sc.rgb * multiplier, 1.0);
24
25
26}
27
void main()
uniform sampler2D uScene
Definition bloom.frag:3
out vec4 fragColor
Definition bloom.frag:6
in vec2 vUV
Definition lightmap.frag:13
float clamp(float a, float b, float c)
Definition mathf.h:379
Definition types.h:11
Definition types.h:13