2015-11-08 23:29:52 +00:00
|
|
|
varying vec2 texCoord;
|
|
|
|
uniform sampler2D tex;
|
2015-11-09 01:10:10 +00:00
|
|
|
uniform float reflectionBrightness;
|
|
|
|
uniform vec2 reflectionDistance;
|
|
|
|
uniform float lightBrightness;
|
|
|
|
|
|
|
|
const float speed = 2.0;
|
|
|
|
const float decay = 2.0;
|
|
|
|
const float coeff = 2.5;
|
2015-11-08 23:29:52 +00:00
|
|
|
|
|
|
|
void main() {
|
2015-11-09 01:10:10 +00:00
|
|
|
float sp = pow(speed, lightBrightness);
|
|
|
|
float dc = pow(decay, -lightBrightness);
|
|
|
|
float s = (sp - dc) / (sp + dc);
|
|
|
|
vec2 radius = (texCoord.st - vec2(0.5, 0.5)) * vec2(coeff * s);
|
2016-02-21 07:43:09 +00:00
|
|
|
radius = pow(abs(radius), vec2(4.0));
|
2015-11-08 23:29:52 +00:00
|
|
|
vec3 bleed = vec3(0.12, 0.14, 0.19);
|
2015-11-09 01:10:10 +00:00
|
|
|
bleed += (dot(radius, radius) + vec3(0.02, 0.03, 0.05)) * vec3(0.14, 0.18, 0.2);
|
|
|
|
|
|
|
|
vec4 color = texture2D(tex, texCoord);
|
|
|
|
color.rgb += pow(bleed, pow(vec3(lightBrightness), vec3(-0.5)));
|
|
|
|
|
|
|
|
vec4 reflection = texture2D(tex, texCoord - reflectionDistance);
|
|
|
|
color.rgb += reflection.rgb * reflectionBrightness;
|
2015-11-08 23:29:52 +00:00
|
|
|
color.a = 1.0;
|
|
|
|
gl_FragColor = color;
|
|
|
|
}
|