Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. precision mediump float;
  2. // template : glsl.ergonenous-tones.com
  3.  
  4. varying vec2 tcoord; // location
  5. uniform sampler2D tex; // texture one
  6. uniform sampler2D tex2; // texture two
  7. uniform vec2 tres; // size of texture (screen)
  8. uniform vec4 fparams; // 4 floats coming in
  9. uniform ivec4 iparams; // 4 ints coming in
  10. uniform float ftime; // 0.0 to 1.0
  11. uniform int itime; // increases when ftime hits 1.0
  12. //f0::
  13. //f1::
  14. //f2::
  15. float f0 = mix(0.05, 0.95, fparams[0]);
  16. float f1 = mix(0.05, 0.95, fparams[1]);
  17. float f2 = mix(0.05, 0.95, fparams[2]);
  18.  
  19. float time = float(itime) + ftime;
  20. vec2 resolution = tres;
  21.  
  22. #define Size 0.192
  23. #define ScreenL 4.686
  24. #define SphereOpacity 0.006
  25. #define Color vec3(1,0.38,0.38)
  26. #define R1 5.475
  27. #define G1 6.954
  28. #define B1 6.313
  29.  
  30. float sincostex(vec3 p,float s){
  31. p*=s;
  32. return cos(p.x)*sin(p.y)*cos(p.z)*0.5+0.5;
  33. }
  34.  
  35. vec4 of(vec3 p){
  36. p*=(sin(time*2.0)*0.5+1.5);
  37.  
  38. p*=(sin(time*2.0)*0.5+1.5);
  39. float ct=cos(time);float st=sin(time);
  40. p.xz*=mat2(ct,-st,st,ct);
  41. ct=cos(time*0.5);st=sin(time*0.5);
  42. p.xy*=mat2(ct,-st,st,ct);
  43.  
  44.  
  45. vec3 op=p;
  46. vec3 a1=p*(1.0+sin(op.yzx*4.0)*0.4);
  47. vec3 a2=p*(1.0+sin(op*4.0)*0.4);
  48. p=mix(a1,a2,sin(time*0.1)*0.5+0.5);
  49.  
  50. vec3 n=normalize(p);
  51. p*=(0.5+sincostex(n,sin(floor(time))*10.0+10.0));
  52. float a=length(p)<(sincostex(n,Size*10.0)+2.0)?SphereOpacity:0.0;
  53.  
  54. vec3 color=vec3(
  55. sin(p.x*R1)*0.5+0.6,
  56. sin(p.y*G1)*0.5+0.1,
  57. sin(p.z*B1)*0.5+0.9)*Color;
  58. return vec4(color,a);
  59. }
  60.  
  61. // http://glslsandbox.com/e#58966.0
  62.  
  63. void main( void ) {
  64.  
  65. vec2 uv=resolution;
  66. uv=(gl_FragCoord.xy-uv*.5)/uv.y;
  67.  
  68. vec3 ro=vec3(0,0,5);
  69. vec3 r=normalize(vec3(uv,-1));
  70.  
  71. vec4 color;
  72. vec4 d;
  73. vec3 p;
  74. float f=1.0;
  75. for(int i=0;i<400;i++){
  76. p=ro+f*r;
  77. d=of(p);
  78. color+=vec4(d.xyz*d.w,d.w);
  79. if (f>8.0) break;
  80. if (color.w>1.0) break;
  81. f+=0.02;
  82. }
  83.  
  84. gl_FragColor=vec4(color.xyz*ScreenL,1);
  85.  
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement