Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2013-2015 Snailsoft <https://github.com/snailsoft/starborn/>
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the
  6. * Free Software Foundation; either version 2 of the License, or (at your
  7. * option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17.  
  18. uniform float fade_time;
  19. uniform float time;
  20.  
  21. uniform vec2 resolution;
  22.  
  23. float random(vec2 value)
  24. {
  25. return fract(sin(dot(value, vec2(12.9898, 78.233))) * 43758.5453);
  26. }
  27.  
  28. void main()
  29. {
  30. float rand = 0.0;
  31. float star = 0.0;
  32.  
  33. if(random(gl_FragCoord / resolution) > 0.995)
  34. {
  35. rand = random(gl_FragCoord);
  36. star = rand * (0.225 * sin((time * (rand * 5.0)) + (720.0 * rand)) + 0.5);
  37. }
  38.  
  39. gl_FragColor = vec4(vec3((rand < 0.85) ? vec3(1.0) : ((rand < 0.9) ? vec3(0.0, 1.0, 0.5) : vec3(0.0, 1.0, 1.0))) * (1.6 - length(((gl_FragCoord / resolution) * 2.0) - 1.0)), ((fade_time > 0.0) ? max(0.0, 1.0 - (time - fade_time)) : min(1.0, time)) * star);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement