#version 450 core const float GLOW_STEP_0 = 0.480; // inner (min = 0.0) const float GLOW_STEP_1 = 0.975; // outer (max = 0.5) const float GLOW_PULSE_SIZE_0 = 0.010; // inner (+/-) const float GLOW_PULSE_SIZE_1 = 0.025; // outer (+/-) const float GLOW_PULSE_TIME = 2.000; in FragmentData { vec2 texCoords; } data; layout (std140, binding = 2) uniform Global { float time; } global; layout(location = 3) uniform vec4 glowColor; uniform sampler2D tex; out vec4 color; void main() { vec2 texCoords = data.texCoords - vec2(0.5); float radius = length(texCoords); float bgPulse = sin(GLOW_PULSE_TIME * global.time); float alpha = 1.0 - smoothstep( GLOW_STEP_0 + GLOW_PULSE_SIZE_0 * bgPulse, GLOW_STEP_1 + GLOW_PULSE_SIZE_1 * bgPulse, radius); vec4 tex = texture(tex, data.texCoords); vec4 glow = vec4(glowColor.rgb, glowColor.a * alpha); color = tex * tex.a + glow * (1.0 - tex.a); }