eanix.shader 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. shader_type spatial;
  2. render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,unshaded;
  3. uniform float iTime;
  4. uniform sampler2D iChannel0;
  5. //my https://www.shadertoy.com/view/4tGcD1
  6. // Created by Danil (2018+)
  7. // License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
  8. void vertex() {
  9. }
  10. vec3 saturate(vec3 a){return clamp(a,0.,1.);}
  11. float rand(vec2 co){
  12. return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
  13. }
  14. float xRandom(float x){
  15. return mod(x*7241.6465+2130.465521, 64.984131);
  16. }
  17. float hash2(vec2 co){
  18. return fract(sin(dot(-1.+co.xy ,vec2(12.9898,78.233))) * 43758.5453);
  19. }
  20. float hash( vec2 p) {
  21. vec2 pos = fract(p / 128.) * 128. + vec2(-64.340622, -72.465622);
  22. return fract(dot(vec3(pos.xy,pos.x) * vec3(pos.xy,pos.y), vec3(20.390625, 60.703125, 2.4281209)));
  23. }
  24. float noise( float y, float t)
  25. {
  26. vec2 fl = vec2(floor(y), floor(t));
  27. vec2 fr = vec2(fract(y), fract(t));
  28. float a = mix(hash(fl + vec2(0.0,0.0)), hash(fl + vec2(1.0,0.0)),fr.x);
  29. float b = mix(hash(fl + vec2(0.0,1.0)), hash(fl + vec2(1.0,1.0)),fr.x);
  30. return mix(a,b,fr.y);
  31. }
  32. float noise2( float y, float t)
  33. {
  34. vec2 fl = vec2(floor(y), floor(t));
  35. vec2 fr = vec2(fract(y), fract(t));
  36. float a = mix(hash2(fl + vec2(0.0,0.0)), hash2(fl + vec2(1.0,0.0)),fr.x);
  37. float b = mix(hash2(fl + vec2(0.0,1.0)), hash2(fl + vec2(1.0,1.0)),fr.x);
  38. return mix(a,b,fr.y);
  39. }
  40. float line(vec2 uv,float width, float center)
  41. {
  42. float b = (1.- smoothstep(.0, width/2., (uv.y-center)))*1.;//abs
  43. float b2 = (1.- smoothstep(.0, 5.*width, (uv.y-center)))*.8;//abs
  44. return b;//+b2;
  45. }
  46. //const vec3 dark=vec3(0.101,,0.074,0.129);
  47. //const vec3 white=vec3(0.611,0.878,0.819);
  48. //const vec3 red=vec3(0.415,00.211,0.172);
  49. //const vec3 redw=vec3(0.992,0.509,0.466);
  50. float circle( in vec2 uv, float r1, float r2, bool disk)
  51. {
  52. float w = 2.0*fwidth(uv.x);
  53. float t = r1-r2;
  54. float r = r1;
  55. if(!disk)
  56. return smoothstep(-w/2.0, w/2.0, abs(length(uv) - r) - t/2.0);
  57. else
  58. return smoothstep(-w/3.0, w/3.0, (length(uv) - r) );
  59. }
  60. mat2 MD(float a){return mat2(vec2(cos(a), -sin(a)), vec2(sin(a), cos(a)));}
  61. //float animstart=2.5;
  62. vec3 strucb(vec2 uv){
  63. vec3 red=vec3(0.415,00.211,0.172);
  64. vec3 redw=vec3(0.992,0.509,0.466);
  65. vec3 white=vec3(0.611,0.878,0.819);
  66. vec3 dark=vec3(0.101,0.074,0.129);
  67. float animstart=6.5;
  68. float d=step(-0.14,uv.y)*step(uv.y,-0.127)*step(abs(uv.x+0.19),0.02);
  69. vec3 ret=vec3(0.);
  70. d=max(d,step(-0.14,uv.y)*(1.-circle(uv+vec2(0.225,0.14),0.02270,0.35,true)));
  71. d=max(d,step(-0.14,uv.y)*(1.-circle(uv+vec2(0.165,0.14),0.02970,0.35,true)));
  72. d=max(d,step(uv.y,-0.094)*step(-0.14,uv.y)*smoothstep(0.0031,0.0008,abs(uv.x+0.12)));
  73. d=max(d,step(uv.y,-0.115)*step(-0.14,uv.y)*smoothstep(0.0031,0.0008,abs(uv.x+0.1075)));
  74. ret=d*red;
  75. float tuvx=mod(uv.x,0.006)-0.003;
  76. d=step(-0.132,uv.y);
  77. d=step(abs(uv.x+0.225),0.015)*d*smoothstep(0.0031,0.0005,abs(tuvx))*(1.-circle(uv+vec2(0.225,0.143),0.021970,0.35,true));
  78. ret=mix(ret,redw*1.25,d);
  79. tuvx=mod(uv.x-0.093,0.012)-0.006;
  80. d=smoothstep(0.0061,0.0035,abs(tuvx))*step(abs(uv.y+0.122),0.00182);
  81. ret=mix(ret,white,d*step(abs(uv.x+0.165),0.0165));
  82. return ret*smoothstep(animstart+2.2,animstart+3.2,iTime); //anim sruct
  83. }
  84. vec3 postfx(vec2 uv, vec3 col,float reg){
  85. vec3 ret=col+ 1.5*reg*((rand(uv)-.5)*.07);
  86. ret = saturate(1.5*ret);
  87. return ret;
  88. }
  89. float animendfade(){
  90. float animstart=6.5;
  91. return smoothstep(animstart+11.5,animstart+9.5,iTime);
  92. }
  93. float animendfades(){
  94. float animstart=6.5;
  95. return step(animstart+9.5,iTime);
  96. }
  97. vec3 map(vec2 uv, float lt){
  98. vec3 red=vec3(0.415,00.211,0.172);
  99. vec3 redw=vec3(0.992,0.509,0.466);
  100. vec3 white=vec3(0.611,0.878,0.819);
  101. vec3 dark=vec3(0.101,0.074,0.129);
  102. float animstart=6.5;
  103. float PI=(4.0 * atan(1.0));
  104. float TWO_PI=PI*2.;
  105. float d=(circle(uv,0.32*smoothstep(animstart-1.,animstart+0.35,iTime),0.,true));
  106. vec3 tcol=d*dark;
  107. float a=1.-circle(uv,0.3542,0.35,false);
  108. vec2 tuv=uv;
  109. float af = atan(tuv.x,tuv.y);
  110. float r = length(tuv)*0.75;
  111. tuv = vec2(af/TWO_PI,r);
  112. a*=step(tuv.x,-PI/2.+PI*smoothstep(animstart+2.5,animstart+4.8,iTime));//anim circle
  113. vec3 ret=max(tcol,a*(1.-lt)*redw);
  114. ret=max(ret,lt*dark);
  115. ret=max(ret,(1.-lt)*(1.-d)*red)*smoothstep(animstart-1.,animstart+0.35,iTime);
  116. float b=1.-circle(uv+vec2(0.,0.225*smoothstep(animstart,animstart-2.,iTime)),0.2242,0.22,true);
  117. tuv=uv;
  118. //tuv*=MD(-0.05-0.2*smoothstep(-0.25,0.85,uv.x));;
  119. //tuv.y+= ((cos(.85*tuv.x))-.975);
  120. float tuvy=mod(tuv.y,0.015)-0.0075;
  121. float e=1.-max(smoothstep(0.0005,0.0031,abs(tuvy)),step(0.195,tuv.y)+step(tuv.y,0.185)*step(0.165,tuv.y)+
  122. step(tuv.y,0.14)*step(0.06,tuv.y)+step(tuv.y,0.03)*step(0.015,tuv.y));
  123. //anim 1
  124. /*float di=floor(animstart+iTime*1.5); //anim
  125. di+=di>1.?1.:0.;
  126. di+=di>4.?5.:0.;
  127. di+=di>11.?1.:0.;
  128. float ir=mod(animstart+iTime*1.5,1.); //anim
  129. e*=1.-(max(step((-uv.y+di*(1.*0.015)+0.0075),0.0075),
  130. step(ir-0.5,uv.x)*step(abs(uv.y-di*(1.*0.015)+0.0075),0.0075)));*/
  131. //anim 2
  132. float di=smoothstep(animstart+4.5,animstart+6.5,iTime); //anim
  133. float di2=smoothstep(animstart+8.5,animstart+9.5,iTime);
  134. e*=step(uv.x+1.5*uv.y*(1.-di),di-0.5);
  135. e*=step(di2-.5,uv.x-2.*uv.y*(1.-di2));
  136. e=(1.-e)*(b);
  137. ret=max(ret,(1.-lt)*e*white);
  138. float c=1.-circle(uv,0.3542,0.35,true);
  139. tuvy=(mod(uv.y,0.026+0.1*smoothstep(-.5,0.5,uv.y))-0.013-0.05*smoothstep(-.5,0.5,uv.y));
  140. e=smoothstep(0.001,0.0051,abs(tuvy));
  141. e=((step(uv.y,-0.109))*c*(1.-e*step(uv.y,-0.109)));
  142. e*=step(abs(uv.x),0.5*smoothstep(animstart+1.5,animstart+3.,iTime)); //anim bot lines
  143. ret=max(ret,red*e);
  144. tuv=uv;
  145. tuv*=MD(3.3-sin(01.0-cos(2.0*smoothstep(animstart+4.25,animstart+5.5,iTime)))); //anim pl2
  146. tuv+=vec2(0.35521,0.);
  147. float f=1.-circle(tuv,0.0270,0.35,true);
  148. ret=max(ret,f*redw*(1.-lt));
  149. tuv=uv;
  150. tuv*=MD(-0.3+01.*smoothstep(animstart+2.,animstart+4.8,iTime));
  151. tuv+=vec2(0.2242,0.);
  152. //float fa=f;
  153. f=1.-circle(tuv,0.0570,0.35,true);
  154. ret=max(ret*(1.-(1.-lt)*f),(1.-lt)*f*dark*(1.-lt));
  155. ret=max(ret,strucb(uv));
  156. //ret=postfx(uv,ret,max(c,fa));
  157. f*=animendfade();
  158. return max(dark,max(ret*animendfade(),
  159. max((1.-f)*b*white*(1.-animendfade()),max((1.-f)*b*white*(1.-lt)*animendfades(),
  160. (1.-f)*b*white*(lt)*(1.-animendfade()))))); //anim
  161. }
  162. float fin(vec2 p){
  163. return smoothstep(0.48,0.49,length(p));
  164. }
  165. float animm(){
  166. float animstart=6.5;
  167. return smoothstep(animstart,animstart+1.5,iTime);
  168. }
  169. vec4 mainImage(in vec2 uv )
  170. {
  171. float Range = 10.;
  172. vec3 retcol=vec3(0.);
  173. if(iTime<28.){
  174. //anim
  175. float Line_Smooth = animm()*
  176. pow(smoothstep(Range,Range-.05,2.*Range*(abs(smoothstep(.0, Range,uv.x+.5 )-.5))),.2);
  177. float rndx=iTime;
  178. rndx=100.;
  179. rndx*=20.;
  180. float Factor_T =floor(rndx);
  181. float Factor_X =xRandom(uv.x*.0021);
  182. float Amplitude1 =0.5000 * noise(Factor_X, Factor_T)
  183. +0.2500 * noise(Factor_X, Factor_T)
  184. +0.1250 * noise(Factor_X, Factor_T)
  185. +0.0625 * noise(Factor_X, Factor_T);
  186. Factor_X =xRandom(uv.x*.0031+.0005);
  187. float Amplitude2 =0.5000 * noise2(Factor_X, Factor_T)
  188. +0.2500 * noise2(Factor_X, Factor_T)
  189. +0.1250 * noise2(Factor_X, Factor_T)
  190. +0.0625 * noise2(Factor_X, Factor_T);
  191. vec2 p=uv;
  192. p.y+=((cos(.5*p.x-0.15))-.975)*animm(); //anim
  193. float Light_Track = line(vec2(p.x,p.y*2.+(Amplitude2-.5)*.12*Line_Smooth), .005, .0);
  194. float Light_Track2 = line(vec2(uv.x,uv.y+(Amplitude2-.5)*.16*Line_Smooth), .005, .0);
  195. vec3 red=vec3(0.415,00.211,0.172);
  196. vec3 redw=vec3(0.992,0.509,0.466);
  197. vec3 white=vec3(0.611,0.878,0.819);
  198. vec3 dark=vec3(0.101,0.074,0.129);
  199. float animstart=6.5;
  200. float PI=(4.0 * atan(1.0));
  201. float TWO_PI=PI*2.;
  202. vec3 line1 = Light_Track*dark;
  203. //vec4 line2 = vec4(Light_Track2)*Light_Color2;
  204. retcol=map(uv,Light_Track);
  205. }
  206. vec4 fragColor =vec4(retcol,1.-fin(uv));
  207. if(iTime>25.){
  208. vec4 ttxx=texture(iChannel0,vec2((uv+0.5).x,1.-(uv+0.5).y))*smoothstep(26.,27,iTime);
  209. fragColor=mix(fragColor*smoothstep(26.,25,iTime),ttxx,ttxx.a);
  210. }
  211. fragColor.a*=smoothstep(2.,3.5,iTime);
  212. return fragColor;
  213. }
  214. void fragment() {
  215. vec4 tc=mainImage(UV.yx-0.5);
  216. ALBEDO=tc.rgb;
  217. ALPHA=tc.a;
  218. }