res/shaders/ags001.shader/ags001-light.fs (view raw)
1varying vec2 texCoord;
2uniform sampler2D tex;
3uniform float reflectionBrightness;
4uniform vec2 reflectionDistance;
5uniform float lightBrightness;
6
7const float speed = 2.0;
8const float decay = 2.0;
9const float coeff = 2.5;
10
11void main() {
12 float sp = pow(speed, lightBrightness);
13 float dc = pow(decay, -lightBrightness);
14 float s = (sp - dc) / (sp + dc);
15 vec2 radius = (texCoord.st - vec2(0.5, 0.5)) * vec2(coeff * s);
16 radius = pow(radius, vec2(4.0));
17 vec3 bleed = vec3(0.12, 0.14, 0.19);
18 bleed += (dot(radius, radius) + vec3(0.02, 0.03, 0.05)) * vec3(0.14, 0.18, 0.2);
19
20 vec4 color = texture2D(tex, texCoord);
21 color.rgb += pow(bleed, pow(vec3(lightBrightness), vec3(-0.5)));
22
23 vec4 reflection = texture2D(tex, texCoord - reflectionDistance);
24 color.rgb += reflection.rgb * reflectionBrightness;
25 color.a = 1.0;
26 gl_FragColor = color;
27}