uudet musat

This commit is contained in:
2024-07-29 19:35:28 +03:00
2 changed files with 138 additions and 22 deletions

View File

@ -57,11 +57,6 @@ float sdCappedCylinder( vec3 p, float h, float r )
return min(max(d.x,d.y),0.0) + length(max(d,0.0)); return min(max(d.x,d.y),0.0) + length(max(d,0.0));
} }
float sdBox(vec2 p, vec2 r)
{
return length( max(abs(p)-r,0.) );
}
float sdBox2(vec3 p, vec3 b) { float sdBox2(vec3 p, vec3 b) {
vec3 q = abs(p) - b; vec3 q = abs(p) - b;
return length(max(q,0.)) + min(max(q.x,max(q.y,q.z)),0.); return length(max(q,0.)) + min(max(q.x,max(q.y,q.z)),0.);
@ -107,13 +102,12 @@ SEA_WATER_COLOR =vec3(0.4,0.5,0.3);
// with duration d, startTime s and speed up with timeFact // with duration d, startTime s and speed up with timeFact
float timedSine(vec3 i) { float timedSine(vec3 i) {
i.y *= i.z; return min((u_time - i.y)*i.z, i.x*PI);
return PI * min(((u_time * i.z) - i.y) / PI, i.x);
} }
float calcFactor (float startTime) float calcFactor (float startTime)
{ {
return 9. + 9.*clamp(sin(timedSine(vec3(1.5, startTime, 4.)) * 0.06), -.9, .9); return STARTDELAY + STARTDELAY*clamp(sin(timedSine(vec3(1.5, startTime, 4.)) * 0.06), -.9, .9);
} }
// Animate ring movements // Animate ring movements
@ -156,7 +150,7 @@ vec2 map(vec3 p, int displace)
vec3 q = p; vec3 q = p;
q.xy = mat2(cos(anRot),-sin(anRot), q.xy = mat2(cos(anRot),-sin(anRot),
sin(anRot), cos(anRot))*q.xy; sin(anRot), cos(anRot))*q.xy;
float d = sdBox( q.xy - vec2(1.8,0.), vec2(0.24,0.14) ) - .02, float d = length(max(abs(q.xy - vec2(1.8,0.))-vec2(0.24,0.14),0.)) - .02,
// Main ring // Main ring
d2 = abs(length(p.xy) - 1.8) - .2; d2 = abs(length(p.xy) - 1.8) - .2;
@ -237,8 +231,7 @@ vec2 map(vec3 p, int displace)
choppy = mix(choppy,1.0,0.4); choppy = mix(choppy,1.0,0.4);
} }
} }
float cs = sdCappedCylinder(p, .025, 1.6) - h*0.15; d2 = max(-sdCappedCylinder(p, 2.0, min((2.0 - (u_time - 23.0)*3.),2.3)), sdCappedCylinder(p, .025, 1.6) - h*0.15);
d2 = max(-sdCappedCylinder(p, 2.0, clamp((2.0 - 3.*(u_time - 23.0)),-.2,2.3)), cs);
d2 = max(d2, sdCappedCylinder ( p, 0.3, 1.7)); d2 = max(d2, sdCappedCylinder ( p, 0.3, 1.7));
d = min(d, d2); d = min(d, d2);
if (d==d2) mat = 1.0; if (d==d2) mat = 1.0;
@ -326,6 +319,8 @@ vec3 postProcess(vec3 col) {
// Contrast = a // Contrast = a
col = smoothstep(0., 1., col); col = smoothstep(0., 1., col);
// fade out at the end
col += 1.2 - vec3(clamp((32. - u_time)*.35, 0., 1.2));
return col; return col;
} }
@ -338,7 +333,6 @@ vec3 cameraPos()
if (u_time > 10.5) cPos = vec3(2.,-1.,1.); if (u_time > 10.5) cPos = vec3(2.,-1.,1.);
// zoom away for 2nd glyph animation // zoom away for 2nd glyph animation
if (u_time > 12.) cPos = vec3(-1., -.7, 4.); if (u_time > 12.) cPos = vec3(-1., -.7, 4.);
if (u_time > 13.) cPos =mix(vec3(-1., -.7, 4.), vec3(0., 0.5, -1.), (u_time - 13.)*0.3);
return cPos; return cPos;
} }
@ -348,7 +342,6 @@ vec3 cameraPointAt() {
if (u_time > 10.5) p = vec3(1.7,-1.1,0.); if (u_time > 10.5) p = vec3(1.7,-1.1,0.);
// look gate at distance // look gate at distance
if(u_time > 12.) p = vec3(0.); if(u_time > 12.) p = vec3(0.);
if (u_time > 13.) p = mix(vec3(0.), vec3(0., 2., -5.), (u_time - 13.)*0.3);
return p; return p;
} }
@ -361,6 +354,11 @@ vec3 colorFlashesAnim(vec3 col) {
return col; return col;
} }
vec3 addSpecular(vec3 nor, vec3 rod, float amount)
{
return vec3(specular(nor,normalize(vec3(0.0,0.3,0.8)),normalize(rod),60.0))*amount;
}
vec3 sceneGate(vec2 uv) vec3 sceneGate(vec2 uv)
{ {
// Initialization // Initialization
@ -392,16 +390,15 @@ vec3 sceneGate(vec2 uv)
col += indirColor * clamp( dot( n, normalize(vec3(0. , 1., 10.))), 0., 1.); col += indirColor * clamp( dot( n, normalize(vec3(0. , 1., 10.))), 0., 1.);
if(mat==0.) if(mat==0.)
col *= vec3(.3) + vec3(specular(n,normalize(vec3(0.0,0.3,0.8)),normalize(rd),60.0))*0.5; col *= vec3(.3) + addSpecular(n,rd,0.5);
if(mat==1.){ if(mat==1.)
col = getSeaColor(p, n, normalize(vec3(0.0,0.3,0.8)),normalize(rd)); //col = vec3(0.,0.,.5); // + (noise(5.*(p.xy+2.)+u_time, -1.0) * noise(50.*(p.xy+2.), -0.4) + 0.5*noise(20.*(p.xy+2.0)-u_time, -0.5) * noise(5.*(p.xy+2.0), -0.75))*smoothstep(0.,0.75,(u_time-5.0)*0.1) + vec3(0.,0.,0.5*noise(10.*(p.xy+4.0)-u_time, -0.5)); col = getSeaColor(p, n, normalize(vec3(0.0,0.3,0.8)),normalize(rd)); //col = vec3(0.,0.,.5); // + (noise(5.*(p.xy+2.)+u_time, -1.0) * noise(50.*(p.xy+2.), -0.4) + 0.5*noise(20.*(p.xy+2.0)-u_time, -0.5) * noise(5.*(p.xy+2.0), -0.75))*smoothstep(0.,0.75,(u_time-5.0)*0.1) + vec3(0.,0.,0.5*noise(10.*(p.xy+4.0)-u_time, -0.5));
}
if(mat==2.) if(mat==2.)
col *= vec3(.3, .1, .0)+ vec3(specular(n,normalize(vec3(0.0,0.3,0.8)),normalize(rd),60.0))*0.1; // - 0.2*noise((vec2(100.*p.x+300.,75.*p.z+150.0)), -2.2) * noise((vec2(15.*p.x+2.0,3.*p.z+2.)), -1.) + noise((vec2(15.*p.x+2.4,3.*p.z+2.)), -0.25); col *= vec3(.3, .1, .0)+ addSpecular(n,rd,0.1); // - 0.2*noise((vec2(100.*p.x+300.,75.*p.z+150.0)), -2.2) * noise((vec2(15.*p.x+2.0,3.*p.z+2.)), -1.) + noise((vec2(15.*p.x+2.4,3.*p.z+2.)), -0.25);
if(mat==3.) if(mat==3.)
col *= vec3(.8, .8, .5) + noise(p.xz*500.+100., .3,0); // + noise(p.xz*1000.+5000., 0.1) + noise(p.xz*1000.+5000., 0.1); col *= vec3(.8, .8, .5) + noise(p.xz*500.+1e5, .3,0); // + noise(p.xz*1000.+5000., 0.1) + noise(p.xz*1000.+5000., 0.1);
if(mat==4.) if(mat==4.)
col *= vec3(.1)+ vec3(specular(n,normalize(vec3(0.0,0.3,0.8)),normalize(rd),60.0))*0.5; col *= vec3(.1)+ addSpecular(n,rd,0.5);
if(mat ==5.) if(mat ==5.)
col *= chevronColor; // activated glyph color col *= chevronColor; // activated glyph color

View File

@ -85,7 +85,11 @@ const char *__temp_cleaned_shader_glsl =
"m=mix(m,c,m);" "m=mix(m,c,m);"
"return pow(1.-pow(m.x*m.y,.65),y);" "return pow(1.-pow(m.x*m.y,.65),y);"
"}" "}"
<<<<<<< HEAD
"vec2 t(vec3 v,int a)" "vec2 t(vec3 v,int a)"
=======
"vec2 e(vec3 v,int a)"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"{" "{"
"float c=0.,i=m/12.,r=floor(atan(v.y,v.x)/i+.5)*i;" "float c=0.,i=m/12.,r=floor(atan(v.y,v.x)/i+.5)*i;"
"vec3 s=v;" "vec3 s=v;"
@ -110,11 +114,19 @@ const char *__temp_cleaned_shader_glsl =
"if(l>0.)" "if(l>0.)"
"{" "{"
"s.x-=1.95;" "s.x-=1.95;"
<<<<<<< HEAD
"vec3 t=s;" "vec3 t=s;"
"if(y>z)" "if(y>z)"
"t.x=e(vec2(t.x,z));" "t.x=e(vec2(t.x,z));"
"float h=x(vec3(s.x-.06,s.yz),vec2(.1,.15))-.01;" "float h=x(vec3(s.x-.06,s.yz),vec2(.1,.15))-.01;"
"p=max(-x(vec3(t.x-.14,t.yz),vec2(.22))-.01,x(vec3(t),vec2(.2,.12))-.02);" "p=max(-x(vec3(t.x-.14,t.yz),vec2(.22))-.01,x(vec3(t),vec2(.2,.12))-.02);"
=======
"vec3 e=s;"
"if(y>z)"
"e.x=t(vec2(e.x,z));"
"float h=x(vec3(s.x-.06,s.yz),vec2(.1,.15))-.01;"
"p=max(-x(vec3(e.x-.14,e.yz),vec2(.22))-.01,x(vec3(e),vec2(.2,.12))-.02);"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"p=min(p,h);" "p=min(p,h);"
"d=min(d,p);" "d=min(d,p);"
"if(d==p)" "if(d==p)"
@ -123,9 +135,15 @@ const char *__temp_cleaned_shader_glsl =
"c=5.;" "c=5.;"
"}" "}"
"}" "}"
<<<<<<< HEAD
"vec3 t=x(v),l=t;" "vec3 t=x(v),l=t;"
"i=m/16.;" "i=m/16.;"
"l.xy=f(floor(atan(t.y,t.x)/i+.5)*i)*l.xy;" "l.xy=f(floor(atan(t.y,t.x)/i+.5)*i)*l.xy;"
=======
"vec3 e=x(v),l=e;"
"i=m/16.;"
"l.xy=f(floor(atan(e.y,e.x)/i+.5)*i)*l.xy;"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"p=n(l.xyz-vec3(1.75,0,0),vec3(.04,.14,.05))-.02;" "p=n(l.xyz-vec3(1.75,0,0),vec3(.04,.14,.05))-.02;"
"d=min(d,p);" "d=min(d,p);"
"if(d==p)" "if(d==p)"
@ -151,10 +169,16 @@ const char *__temp_cleaned_shader_glsl =
"{" "{"
"vec2 w=v.xy;" "vec2 w=v.xy;"
"for(int u=0;u<4;u++)" "for(int u=0;u<4;u++)"
<<<<<<< HEAD
"k=e((w+y)*C,g),k+=e((w-y)*C,g),h+=k*F,w*=mat2(1.6,1.2,-1.2,1.6),C*=1.9,F*=.22,g=mix(g,1.,.4);" "k=e((w+y)*C,g),k+=e((w-y)*C,g),h+=k*F,w*=mat2(1.6,1.2,-1.2,1.6),C*=1.9,F*=.22,g=mix(g,1.,.4);"
"}" "}"
"float w=x(v,.025,1.6)-h*.15;" "float w=x(v,.025,1.6)-h*.15;"
"p=max(-x(v,2.,clamp(2.-3.*(y-23.),-.2,2.3)),w);" "p=max(-x(v,2.,clamp(2.-3.*(y-23.),-.2,2.3)),w);"
=======
"k=t((w+y)*C,g),k+=t((w-y)*C,g),h+=k*F,w*=mat2(1.6,1.2,-1.2,1.6),C*=1.9,F*=.22,g=mix(g,1.,.4);"
"}"
"p=max(-x(v,2.,min(2.-(y-23.)*3.,2.3)),x(v,.025,1.6)-h*.15);"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"p=max(p,x(v,.3,1.7));" "p=max(p,x(v,.3,1.7));"
"d=min(d,p);" "d=min(d,p);"
"if(d==p)" "if(d==p)"
@ -166,7 +190,11 @@ const char *__temp_cleaned_shader_glsl =
"float m,i=0.;" "float m,i=0.;"
"for(int d=0;d<90;d++)" "for(int d=0;d<90;d++)"
"{" "{"
<<<<<<< HEAD
"m=t(v+y*i,0).x;" "m=t(v+y*i,0).x;"
=======
"m=e(v+y*i,0).x;"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"i+=m;" "i+=m;"
"if(abs(m)<.001||i>4e2)" "if(abs(m)<.001||i>4e2)"
"break;" "break;"
@ -176,16 +204,28 @@ const char *__temp_cleaned_shader_glsl =
"vec3 h(vec3 v)" "vec3 h(vec3 v)"
"{" "{"
"vec2 m=vec2(.01,0);" "vec2 m=vec2(.01,0);"
<<<<<<< HEAD
"vec3 y=t(v,1).x-vec3(t(v-m.xyy,1).x,t(v-m.yxy,1).x,t(v-m.yyx,1));" "vec3 y=t(v,1).x-vec3(t(v-m.xyy,1).x,t(v-m.yxy,1).x,t(v-m.yyx,1));"
=======
"vec3 y=e(v,1).x-vec3(e(v-m.xyy,1).x,e(v-m.yxy,1).x,e(v-m.yyx,1));"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"return normalize(y);" "return normalize(y);"
"}" "}"
"float e(vec3 v,vec3 m,float y,vec3 d)" "float e(vec3 v,vec3 m,float y,vec3 d)"
"{" "{"
<<<<<<< HEAD
"vec3 c=normalize(m-v);" "vec3 c=normalize(m-v);"
"float x=clamp(dot(d,c),0.,1.),p=h(v+d*.0025,c);" "float x=clamp(dot(d,c),0.,1.),p=h(v+d*.0025,c);"
"if(abs(p)<length(m-v))" "if(abs(p)<length(m-v))"
"x*=y;" "x*=y;"
"return x;" "return x;"
=======
"vec3 p=normalize(m-v);"
"float c=clamp(dot(d,p),0.,1.),a=h(v+d*.0025,p);"
"if(abs(a)<length(m-v))"
"c*=y;"
"return c;"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"}" "}"
"float e(vec3 v,vec3 y,vec3 d)" "float e(vec3 v,vec3 y,vec3 d)"
"{" "{"
@ -193,15 +233,24 @@ const char *__temp_cleaned_shader_glsl =
"}" "}"
"vec3 h(vec3 v,vec3 m,vec3 y)" "vec3 h(vec3 v,vec3 m,vec3 y)"
"{" "{"
<<<<<<< HEAD
"vec3 c=normalize(vec3(0,.3,.8));" "vec3 c=normalize(vec3(0,.3,.8));"
"float p=clamp(1.-dot(m,-y),0.,1.);" "float p=clamp(1.-dot(m,-y),0.,1.);"
"p=min(pow(p,5.),.5);" "p=min(pow(p,5.),.5);"
"vec3 i=mix(d+pow(dot(m,c)*.4+.6,60.)*r*.3,vec3(0,.5,1),p);" "vec3 i=mix(d+pow(dot(m,c)*.4+.6,60.)*r*.3,vec3(0,.5,1),p);"
"i+=vec3(e(m,c,y))*.3;" "i+=vec3(e(m,c,y))*.3;"
=======
"vec3 p=normalize(vec3(0,.3,.8));"
"float c=clamp(1.-dot(m,-y),0.,1.);"
"c=min(pow(c,5.),.5);"
"vec3 i=mix(d+pow(dot(m,p)*.4+.6,60.)*r*.3,vec3(0,.5,1),c);"
"i+=vec3(e(m,p,y))*.3;"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"return i;" "return i;"
"}" "}"
"vec3 t(vec2 v,vec3 y,vec3 m)" "vec3 t(vec2 v,vec3 y,vec3 m)"
"{" "{"
<<<<<<< HEAD
"vec3 d=normalize(m-y),c=normalize(cross(vec3(0,1,0),d));" "vec3 d=normalize(m-y),c=normalize(cross(vec3(0,1,0),d));"
"return normalize(d*2.+v.x*c+v.y*cross(d,c));" "return normalize(d*2.+v.x*c+v.y*cross(d,c));"
"}" "}"
@ -234,9 +283,44 @@ const char *__temp_cleaned_shader_glsl =
"if(y>13.)" "if(y>13.)"
"m=mix(vec3(0),vec3(0,2,-5),(y-13.)*.3);" "m=mix(vec3(0),vec3(0,2,-5),(y-13.)*.3);"
"return m;" "return m;"
=======
"vec3 d=normalize(m-y),p=normalize(cross(vec3(0,1,0),d));"
"return normalize(d*2.+v.x*p+v.y*cross(d,p));"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"}" "}"
"vec3 w(vec3 v)" "vec3 w(vec3 v)"
"{" "{"
<<<<<<< HEAD
=======
"v*=vec3(.9,.8,.7);"
"v=pow(v,vec3(.4545));"
"v=smoothstep(0.,1.,v);"
"v+=1.2-vec3(clamp((37.-y)*.35,0.,1.2));"
"return v;"
"}"
"vec3 e()"
"{"
"vec3 v=vec3(0,clamp(6.-y,2.,6.),clamp(75.-y*8.,6.,75.));"
"if(y>7.5)"
"v+=vec3(0,clamp(7.5-y,-1.,0.),0);"
"if(y>10.5)"
"v=vec3(2,-1,1);"
"if(y>12.)"
"v=vec3(-1,-1,4);"
"return v;"
"}"
"vec3 f()"
"{"
"vec3 v=vec3(0,-.5,0);"
"if(y>10.5)"
"v=vec3(1.7,-1.1,0);"
"if(y>12.)"
"v=vec3(0,.1,0);"
"return v;"
"}"
"vec3 w(vec3 v)"
"{"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"if(y>10.75)" "if(y>10.75)"
"{" "{"
"float m=smoothstep(-1.,.8,sin(n(vec3(.8,10.75,8))*2.));" "float m=smoothstep(-1.,.8,sin(n(vec3(.8,10.75,8))*2.));"
@ -244,19 +328,34 @@ const char *__temp_cleaned_shader_glsl =
"}" "}"
"return v;" "return v;"
"}" "}"
<<<<<<< HEAD
"vec3 l(vec2 v)" "vec3 l(vec2 v)"
"{" "{"
=======
"vec3 w(vec3 v,vec3 y,float m)"
"{"
"return vec3(e(v,normalize(vec3(0,.3,.8)),normalize(y)))*m;"
"}"
"vec3 l(vec2 v)"
"{"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"vec3 m=e(),y=t(v,m,f()),d=vec3(0);" "vec3 m=e(),y=t(v,m,f()),d=vec3(0);"
"float x=h(m,y);" "float x=h(m,y);"
"if(x<150.)" "if(x<150.)"
"{" "{"
<<<<<<< HEAD
"vec3 l=m+y*x,r=h(l);" "vec3 l=m+y*x,r=h(l);"
"float g=t(l,0).y,z=e(l,vec3(10,15,25),.2,r);" "float g=t(l,0).y,z=e(l,vec3(10,15,25),.2,r);"
=======
"vec3 l=m+y*x,r=e(l);"
"float g=e(l,0).y,z=e(l,vec3(10,15,25),.2,r);"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"d+=z*i;" "d+=z*i;"
"z=e(l,vec3(4,2,-15),1.,r);" "z=e(l,vec3(4,2,-15),1.,r);"
"d+=z*k;" "d+=z*k;"
"d+=s*clamp(dot(r,normalize(vec3(0,1,10))),0.,1.);" "d+=s*clamp(dot(r,normalize(vec3(0,1,10))),0.,1.);"
"if(g==0.)" "if(g==0.)"
<<<<<<< HEAD
"d*=vec3(.3)+vec3(e(r,normalize(vec3(0,.3,.8)),normalize(y)))*.5;" "d*=vec3(.3)+vec3(e(r,normalize(vec3(0,.3,.8)),normalize(y)))*.5;"
"if(g==1.)" "if(g==1.)"
"d=h(l,r,normalize(y));" "d=h(l,r,normalize(y));"
@ -266,17 +365,37 @@ const char *__temp_cleaned_shader_glsl =
"d*=vec3(.8,.8,.5)+n(l.xz*5e2+1e2,.3,0);" "d*=vec3(.8,.8,.5)+n(l.xz*5e2+1e2,.3,0);"
"if(g==4.)" "if(g==4.)"
"d*=vec3(.1)+vec3(e(r,normalize(vec3(0,.3,.8)),normalize(y)))*.5;" "d*=vec3(.1)+vec3(e(r,normalize(vec3(0,.3,.8)),normalize(y)))*.5;"
=======
"d*=vec3(.3)+w(r,y,.5);"
"if(g==1.)"
"d=h(l,r,normalize(y));"
"if(g==2.)"
"d*=vec3(.3,.1,0)+w(r,y,.1);"
"if(g==3.)"
"d*=vec3(.8,.8,.5)+n(l.xz*5e2+1e5,.3,0);"
"if(g==4.)"
"d*=vec3(.1)+w(r,y,.5);"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"if(g==5.)" "if(g==5.)"
"d*=p;" "d*=p;"
"}" "}"
"d=mix(d,mix(a,c,pow(max(dot(y,vec3(0,-.1,-1)),0.),8.)),1.-exp(-x*.01));" "d=mix(d,mix(a,c,pow(max(dot(y,vec3(0,-.1,-1)),0.),8.)),1.-exp(-x*.01));"
"d=w(d);" "d=w(d);"
<<<<<<< HEAD
"return t(d);" "return t(d);"
"}" "}"
"void main()" "void main()"
"{" "{"
"vec2 m=(gl_FragCoord.xy*2.-v.xy)/v.y;" "vec2 m=(gl_FragCoord.xy*2.-v.xy)/v.y;"
"gl_FragColor=vec4(l(m),1);" "gl_FragColor=vec4(l(m),1);"
=======
"return h(d);"
"}"
"void main()"
"{"
"vec2 y=(gl_FragCoord.xy*2.-v.xy)/v.y;"
"gl_FragColor=vec4(l(y),1);"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"}"; "}";
#endif // SHADER_MINIFIED_H_ #endif // SHADER_MINIFIED_H_