display.shader 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. shader_type canvas_item;
  2. uniform sampler2D iChannel1;
  3. uniform sampler2D iChannel2;
  4. uniform float iTime;
  5. uniform float conf_click;
  6. uniform int iFrame;
  7. uniform bool minif;
  8. uniform bool minif2;
  9. uniform float play_click;
  10. uniform bool ppoff;
  11. uniform float sval;
  12. uniform float ssval;
  13. uniform float msval;
  14. uniform bool psval;
  15. float rand(vec2 co){
  16. return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
  17. }
  18. /*
  19. float noise( in vec3 x )
  20. {
  21. x*=0.01;
  22. float z = x.z*256.0;
  23. vec2 offz = vec2(0.317,0.123);
  24. vec2 uv1 = x.xy + offz*floor(z);
  25. vec2 uv2 = uv1 + offz;
  26. return mix(textureLod( iChannel1, uv1 ,0.0).x,textureLod( iChannel1, uv2 ,0.0).x,fract(z));
  27. }
  28. float fbm2(in vec3 p, float iTime)
  29. {
  30. float f = 0.;p*=8.;
  31. f += .850000 * noise(1. * (p+vec3(0.,0.,iTime*0.275)));
  32. f += .25000 * noise(2. * (p+vec3(0.,0.,iTime*0.275)));
  33. f += .12500 * noise(4. * (p+vec3(0.,0.,iTime*0.275)));
  34. f += .06250 * noise(8. * (p+vec3(0.,0.,iTime*0.275)));
  35. return f;
  36. }
  37. */
  38. /*
  39. float n2D( in vec2 x ){return textureLod( iChannel1, x/256. ,0.0).x;}
  40. float fbm(vec2 p){ return n2D(p)*.533 + n2D(p*2.)*.267 + n2D(p*4.)*.133 + n2D(p*8.)*.067; }
  41. */
  42. vec4 add_ui(vec2 uv,vec2 res){
  43. float grid = 0.5-max(abs(mod(uv.x*64.0,1.0)-0.5), abs(mod(uv.y*64.0,1.0)-0.5));
  44. grid=0.4+smoothstep(0.0,64.0 / 600.,grid)*0.65;
  45. if(!(uv.x<res.x/2.-0.14)){
  46. uv.x-=res.x/2.-0.05;
  47. float ea=smoothstep(0.38,0.36,abs(uv.y));
  48. float eaa=ea*smoothstep(0.04,0.03,abs(uv.x+0.004));
  49. ea*=smoothstep(0.132,0.115, length(vec2(uv.x,uv.y*0.35)));
  50. ea*=smoothstep(0.05,0.04, abs(uv.x));
  51. uv*=4.;
  52. uv.y=-uv.y;
  53. vec3 wave_color = vec3(0.0);
  54. uv.x += (-0.035 )*2.;
  55. float aval=smoothstep(0.38,0.36,-uv.y/4.+(1.-ssval)*(1.-0.28));
  56. if(ppoff)return vec4(vec3(0.05,0.3,0.9)*vec3(0.35+(rand(uv) - .5)*.07),0.85*aval*eaa*smoothstep(0.07,0.05,abs(uv.x+0.08)));
  57. for(float i = 0.0; i < 4.0; i++) {
  58. uv.x += (0.035 );
  59. float wave_width = (1.0 / (100.0 * max(0.0001,abs(uv.x))));
  60. wave_color += vec3(wave_width * uv.y*2., wave_width * 0.734* (max(uv.y,0.)+01.5) , 01.8*wave_width *(-uv.y+0.5)).bgr;
  61. }
  62. wave_color=ea*clamp(wave_color,vec3(0.),vec3(10.));
  63. if(psval){
  64. wave_color=wave_color.brr;
  65. }
  66. //wave_color.rgb=mix(wave_color.rgb,pow(clamp(wave_color.rgb*0.5,vec3(0.),vec3(2.)),vec3(2.)),0.5+0.5*sin(iTime));
  67. float a=dot(wave_color*0.6,wave_color);
  68. a=clamp(a,0.,1.);
  69. float aval2=smoothstep(0.55,0.36,-uv.y/4.+(1.-ssval)*(1.-0.28));
  70. wave_color.rgb*=aval;
  71. a=0.5*a+0.5*a*aval2;
  72. vec4 rtx = vec4(wave_color,a)*grid+0.*(1.-a)*0.25*grid*eaa;
  73. rtx.rgb=mix(rtx.brg,rtx.rgb,ssval);
  74. rtx.a=min(rtx.a,1.)*0.358;
  75. //rtx.rgb=pow(rtx.rgb,vec3(2.));
  76. return rtx;
  77. }
  78. if(!(uv.x<-res.x/2.+0.14))return vec4(0.);
  79. uv.x+=res.x/2.-0.05;
  80. float ea=smoothstep(0.38,0.36,abs(uv.y));
  81. float eaa=ea*smoothstep(0.027,0.025,abs(uv.x-0.004));
  82. ea*=smoothstep(0.132,0.115, length(vec2(uv.x,uv.y*0.35)));
  83. ea*=smoothstep(0.05,0.029, abs(uv.x-0.004));
  84. uv*=4.;
  85. uv.y=-uv.y;
  86. uv.x+=-0.11;
  87. float aval=smoothstep(0.38,0.36,-uv.y/4.+(1.-sval)*(1.-0.28));
  88. if(ppoff)return vec4(vec3(0.9,0.1,0.05)*vec3(0.35+(rand(uv) - .5)*.07),0.85*aval*eaa*smoothstep(0.07,0.05,abs(uv.x+0.08)));
  89. vec3 wave_color = vec3(0.0);
  90. for(float i = 0.0; i < 6.0; i++) {
  91. uv.x += (0.025)*(smoothstep(0.4*4.,0.82,abs(uv.y)));
  92. float wave_width = (1.0 / (180.0 * max(0.0001,abs(uv.x))));
  93. wave_color += vec3(wave_width * uv.y*3., wave_width * 0.34* (max(uv.y,0.)+02.) , 01.8*wave_width *(-uv.y+01.5));
  94. }
  95. wave_color=ea*clamp(wave_color,vec3(0.),vec3(10.));
  96. wave_color=mix(wave_color,vec3(dot(wave_color,wave_color),0.,0.),smoothstep(0.,0.18,msval));
  97. //wave_color.rgb=mix(wave_color.rgb,pow(clamp(wave_color.rgb*0.5,vec3(0.),vec3(2.)),vec3(2.)),0.5+0.5*sin(iTime));
  98. float a=dot(wave_color*0.6,wave_color);
  99. a=clamp(a,0.,1.);
  100. float aval2=smoothstep(0.52,0.36,-uv.y/4.+(1.-sval)*(1.-0.28));
  101. wave_color.rgb*=aval;
  102. a=0.5*a+0.5*a*aval2;
  103. vec4 rtx= vec4(wave_color,a)*grid+(1.-a)*0.25*grid*eaa;
  104. rtx.a=min(rtx.a,1.)*0.358;
  105. //rtx.rgb=pow(rtx.rgb,vec3(2.));
  106. return rtx;
  107. }
  108. float get_pause_anim_timer(){return smoothstep(1.5,3.0,iTime);}
  109. float get_pause_anim_timer2(){return smoothstep(.75,2.0,iTime);}
  110. float get_pause_anim_timer3(){return smoothstep(0.30,.950,iTime);}
  111. float get_pause_anim_timer4(){return smoothstep(2.8,4.30,iTime);}
  112. vec3 eff1(vec2 uv, vec4 col, vec4 c1, vec2 res, float px, float vignetteAmt){
  113. vec3 bg = col.rgb;
  114. if(minif)c1.rgb=mix(vec3(0.5509,0.42117,0.61725),c1.rgb,1.-smoothstep(conf_click+0.5,conf_click+2.,iTime));
  115. col=clamp(col,vec4(0.),vec4(10.));
  116. bg=mix(c1.rgb,bg,col.a);
  117. if(ppoff){
  118. vec4 tcx=add_ui(uv,res);
  119. bg=mix(bg,tcx.rgb,tcx.a);
  120. return bg;
  121. }
  122. float eval=1.;
  123. /*float ns = fbm(uv*10. + 17.3);
  124. ns = mix(ns, sin(ns*32. - cos(ns*34.)), .125);
  125. eval *= max(ns, 0.)*.24 + .8;*/
  126. /*
  127. vec3 ro = vec3( -0., 0., 1.);
  128. vec3 cw = normalize( ro );
  129. vec3 cu = normalize( cross(cw,vec3(0.,1.,0.)) );
  130. vec3 cv = normalize( cross(cu,cw) );
  131. vec3 rd = normalize( uv.x*cu + uv.y*cv + 1.5*cw );
  132. ns=fbm2(rd,iTime*3.);
  133. eval *= max(ns, 0.)*.24 + .8;*/
  134. float pat = 0.; //clamp(sin((uv.x - uv.y)*( 600./1.5)) + .5, 0., 1.);
  135. float dv=0.;
  136. float tv=0.;
  137. if((minif2)&&(!minif)){
  138. float imid=floor(abs((uv*mat2(vec2(cos(-.85), -sin(-.85)), vec2(sin(-.85), cos(-.85)))).y/0.015));
  139. float itt=6.*smoothstep(play_click,play_click+6.,iTime);
  140. tv=smoothstep(0.,6.,itt);
  141. dv=1.-step(1.8*smoothstep(0.+imid/30.,2.+imid/20.,0.75*itt),abs(uv*mat2(vec2(cos(-.85), -sin(-.85)), vec2(sin(-.85), cos(-.85)))).x);
  142. pat=max(step(mod((uv*mat2(vec2(cos(-.85), -sin(-.85)), vec2(sin(-.85), cos(-.85)))).y,0.015),0.0075),dv);
  143. }
  144. else{
  145. pat=step(mod((uv*mat2(vec2(cos(-.85), -sin(-.85)), vec2(sin(-.85), cos(-.85)))).y,0.015),0.0075);
  146. }
  147. float rnd = rand(uv);
  148. if(rnd>.5) pat *= .6;
  149. else pat *= 1.4;
  150. pat=mix(pat,1.,dv);
  151. eval *= pat*0.3+0.75;
  152. //eval *= pat*((1.-vignetteAmt)*0.2+.1) + (vignetteAmt*0.2+.75);
  153. vec2 b = res - .05-0.92*(1.-get_pause_anim_timer2());
  154. vec2 q = abs(uv*2.);
  155. float bord = max(q.x - b.x, q.y - b.y);
  156. float qb=-bord;
  157. float tbp=min(1.-smoothstep(0.,px,qb),1.-get_pause_anim_timer());
  158. bg=mix(bg,vec3(0.),tbp);
  159. if(!minif)bord = max(bord, -(bord + .11));
  160. if(minif)eval=max(eval*(1.-smoothstep(0.,px,qb+0.01)),smoothstep(0.,px,qb));
  161. float ntva=min(q.x - b.x + .22+(1.*(1.-get_pause_anim_timer4()))*res.x, q.y - b.y + (.22+1.*(1.-get_pause_anim_timer4())));
  162. bord = max(bord, -ntva);
  163. bord*=get_pause_anim_timer3();
  164. bg = mix(bg, vec3(0), (1. - smoothstep(0., px*12., bord ))*.35);
  165. bg = mix(bg, vec3(0), (1. - smoothstep(0., px, bord))*.27);
  166. bg = mix(bg, bg*2.2, (1. - smoothstep(0., px, bord*( smoothstep(0., px, bord + .035)) + .01)));
  167. bg=mix(bg*eval,bg+(rnd - .5)*.07,step(.9,col.a));
  168. bg *= vignetteAmt;
  169. vec4 tcx=add_ui(uv,res);
  170. tcx=mix(tcx,vec4(0.),tbp);
  171. if((minif2)&&(!minif)){
  172. tcx=mix(tcx*vignetteAmt,tcx,1.-smoothstep(play_click+6.,play_click+2.,iTime));}
  173. else{
  174. tcx*=vignetteAmt;
  175. }
  176. tcx*=smoothstep(0., px*12., -ntva );
  177. bg=mix(bg,tcx.rgb,tcx.a);
  178. //bg = bg / 2. + bg*bg;
  179. //bg = mix(bg.xzy, bg, .75);
  180. bg = mix(bg.xzy, bg, max(tv,uv.y*.3 + .65));
  181. return bg;
  182. }
  183. void mainImage( out vec4 fragColor, in vec2 fragCoord, in vec2 iResolution, sampler2D iChannel0)
  184. {
  185. vec2 res = (iResolution.xy / iResolution.y);
  186. vec2 uv = (fragCoord.xy) / iResolution.y - res / 2.0;
  187. vec2 ouv=fragCoord.xy/iResolution.xy;
  188. vec4 acol=texture(iChannel0,ouv);
  189. vec4 bcol=texture(iChannel2,ouv);//bcol=sqrt(bcol);
  190. vec3 col = vec3(0.);
  191. float vignetteAmt = 1. - dot((ouv-0.5) * 01.265, (ouv-0.5) * 01.265);
  192. col=eff1(uv,acol,bcol,res,1./iResolution.y,vignetteAmt);
  193. fragColor = vec4(col,1.0);
  194. }
  195. void fragment(){
  196. vec2 iResolution=1./TEXTURE_PIXEL_SIZE;
  197. mainImage(COLOR,UV*iResolution,iResolution,TEXTURE);
  198. }