Skip to content

Instantly share code, notes, and snippets.

@OliverUv
Created March 16, 2014 18:17
Show Gist options
  • Save OliverUv/9587476 to your computer and use it in GitHub Desktop.
Save OliverUv/9587476 to your computer and use it in GitHub Desktop.
#version 130
in float distNorm;
out vec4 outputColor;
uniform vec4 line_color;
uniform float time;
uniform float flicker_magnitude;
uniform float color_modifier;
void main()
{
vec4 newColor = line_color;
float color_mod = color_modifier * sin(time*9);
newColor.r *= smoothstep(-1, 1, sin(gl_FragCoord.x/10 + gl_FragCoord.y/color_mod));
newColor.g *= smoothstep(-1, 1, sin(gl_FragCoord.x/color_mod - gl_FragCoord.y/10));
newColor.b *= smoothstep(-1, 1, sin(gl_FragCoord.x/5) * sin(gl_FragCoord.y/5));
// Adjust depending on how far from the 'star' the fragment is.
float c = 1.0 - distNorm;
float alpha_adjust = sin(time * flicker_magnitude + gl_FragCoord.x/10 + gl_FragCoord.y/10);
newColor.r *= c;
newColor.g *= c;
newColor.b *= c;
newColor.a *= c * smoothstep(-1, 1, alpha_adjust);
outputColor = newColor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment