Created
February 15, 2018 11:27
-
-
Save yvan-sraka/ba1df19588d90debfef57aeb7b80bec2 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
// Author: Yvan SRAKA | |
// Title: Sun | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform float u_time; | |
void main(void) { | |
float t = cos(u_time); | |
float u = gl_FragCoord.x / u_resolution.x; | |
float v = gl_FragCoord.y / u_resolution.y; | |
float d = sqrt(pow(gl_FragCoord.x - u_resolution.x/2., 2.) + | |
pow(gl_FragCoord.y - u_resolution.y/2., 2.)) + t*50.; | |
gl_FragColor = | |
(d < 100. + t*50. ? vec4(1., v, u, 1.) : | |
(d < 125. + t*40. ? vec4(.8 + .1*t, v*.8, u*.8, .8) : | |
(d < 150. + t*30. ? vec4(.6 + .2*t, v*.6, u*.6, .6) : | |
(d < 175. + t*20. ? vec4(.4 + .3*t, v*.4, u*.4, .4) : | |
(d < 200. + t*10. ? vec4(.2 + .4*t, v*.2, u*.2, .2) : | |
vec4(.1*t, .1*v, .1*u, .1)))))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment