summary refs log tree commit diff stats
path: root/shaders/bloom2.fragment
blob: da44ea101aaad592829cf03c199856b6ddf51ade (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#version 330 core

in vec2 UV;

out vec3 color;

uniform sampler2D clearTex;
uniform sampler2D blurTex;
uniform float iGlobalTime;

float nrand(vec2 n)
{
  return fract(sin(dot(n.xy, vec2(19.9898, 78.233))) * 43758.5453);
}

void main()
{
  color = vec3(0.0);
  //color += texture(tex2, UV).rgb / 2.0;
  color += texture(blurTex, UV).rgb;
  color = max(vec3(0.0), color - 0.5);
  //color *= color;
  
  //float flicker =  0.5 + nrand(vec2(iGlobalTime));
  //flicker *= (flicker);
  //flicker = sqrt(flicker);
  //flicker = pow(flicker, 1.0/8.0);
  //color *= flicker;
  //color *= mix(vec3(0.0), color, flicker);
  
  color += texture(clearTex, UV).rgb;
  //color = clamp(color, vec3(0.0), vec3(1.0));
}