Created
March 16, 2014 18:17
-
-
Save OliverUv/9587476 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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