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));
}
float sdBox(vec2 p, vec2 r)
{
return length( max(abs(p)-r,0.) );
}
float sdBox2(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
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
float timedSine(vec3 i) {
i.y *= i.z;
return PI * min(((u_time * i.z) - i.y) / PI, i.x);
return min((u_time - i.y)*i.z, i.x*PI);
}
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
@ -156,7 +150,7 @@ vec2 map(vec3 p, int displace)
vec3 q = p;
q.xy = mat2(cos(anRot),-sin(anRot),
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
d2 = abs(length(p.xy) - 1.8) - .2;
@ -236,9 +230,8 @@ vec2 map(vec3 p, int displace)
uv *= mat2(1.6,1.2,-1.2,1.6); freq *= 1.9; amp *= 0.22;
choppy = mix(choppy,1.0,0.4);
}
}
float cs = 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(-sdCappedCylinder(p, 2.0, min((2.0 - (u_time - 23.0)*3.),2.3)), sdCappedCylinder(p, .025, 1.6) - h*0.15);
d2 = max(d2, sdCappedCylinder ( p, 0.3, 1.7));
d = min(d, d2);
if (d==d2) mat = 1.0;
@ -326,6 +319,8 @@ vec3 postProcess(vec3 col) {
// Contrast = a
col = smoothstep(0., 1., col);
// fade out at the end
col += 1.2 - vec3(clamp((32. - u_time)*.35, 0., 1.2));
return col;
}
@ -337,8 +332,7 @@ vec3 cameraPos()
// close up shot for 1st glyph lock
if (u_time > 10.5) cPos = vec3(2.,-1.,1.);
// zoom away for 2nd glyph animation
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);
if (u_time > 12.) cPos = vec3(-1., -.7, 4.);
return cPos;
}
@ -347,8 +341,7 @@ vec3 cameraPointAt() {
// look at 1st glyph
if (u_time > 10.5) p = vec3(1.7,-1.1,0.);
// look gate at distance
if(u_time > 12.) p = vec3(0.);
if (u_time > 13.) p = mix(vec3(0.), vec3(0., 2., -5.), (u_time - 13.)*0.3);
if(u_time > 12.) p = vec3(0.);
return p;
}
@ -361,6 +354,11 @@ vec3 colorFlashesAnim(vec3 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)
{
// Initialization
@ -392,16 +390,15 @@ vec3 sceneGate(vec2 uv)
col += indirColor * clamp( dot( n, normalize(vec3(0. , 1., 10.))), 0., 1.);
if(mat==0.)
col *= vec3(.3) + vec3(specular(n,normalize(vec3(0.0,0.3,0.8)),normalize(rd),60.0))*0.5;
if(mat==1.){
col *= vec3(.3) + addSpecular(n,rd,0.5);
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));
}
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.)
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.)
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.)
col *= chevronColor; // activated glyph color

View File

@ -85,7 +85,11 @@ const char *__temp_cleaned_shader_glsl =
"m=mix(m,c,m);"
"return pow(1.-pow(m.x*m.y,.65),y);"
"}"
<<<<<<< HEAD
"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;"
"vec3 s=v;"
@ -110,11 +114,19 @@ const char *__temp_cleaned_shader_glsl =
"if(l>0.)"
"{"
"s.x-=1.95;"
<<<<<<< HEAD
"vec3 t=s;"
"if(y>z)"
"t.x=e(vec2(t.x,z));"
"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);"
=======
"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);"
"d=min(d,p);"
"if(d==p)"
@ -123,9 +135,15 @@ const char *__temp_cleaned_shader_glsl =
"c=5.;"
"}"
"}"
<<<<<<< HEAD
"vec3 t=x(v),l=t;"
"i=m/16.;"
"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;"
"d=min(d,p);"
"if(d==p)"
@ -151,10 +169,16 @@ const char *__temp_cleaned_shader_glsl =
"{"
"vec2 w=v.xy;"
"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);"
"}"
"float w=x(v,.025,1.6)-h*.15;"
"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));"
"d=min(d,p);"
"if(d==p)"
@ -166,7 +190,11 @@ const char *__temp_cleaned_shader_glsl =
"float m,i=0.;"
"for(int d=0;d<90;d++)"
"{"
<<<<<<< HEAD
"m=t(v+y*i,0).x;"
=======
"m=e(v+y*i,0).x;"
>>>>>>> 9c678c16119a84c2197603631430e7a36a9630fe
"i+=m;"
"if(abs(m)<.001||i>4e2)"
"break;"
@ -176,16 +204,28 @@ const char *__temp_cleaned_shader_glsl =
"vec3 h(vec3 v)"
"{"
"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=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);"
"}"
"float e(vec3 v,vec3 m,float y,vec3 d)"
"{"
<<<<<<< HEAD
"vec3 c=normalize(m-v);"
"float x=clamp(dot(d,c),0.,1.),p=h(v+d*.0025,c);"
"if(abs(p)<length(m-v))"
"x*=y;"
"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)"
"{"
@ -193,15 +233,24 @@ const char *__temp_cleaned_shader_glsl =
"}"
"vec3 h(vec3 v,vec3 m,vec3 y)"
"{"
<<<<<<< HEAD
"vec3 c=normalize(vec3(0,.3,.8));"
"float p=clamp(1.-dot(m,-y),0.,1.);"
"p=min(pow(p,5.),.5);"
"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;"
=======
"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;"
"}"
"vec3 t(vec2 v,vec3 y,vec3 m)"
"{"
<<<<<<< HEAD
"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));"
"}"
@ -234,9 +283,44 @@ const char *__temp_cleaned_shader_glsl =
"if(y>13.)"
"m=mix(vec3(0),vec3(0,2,-5),(y-13.)*.3);"
"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)"
"{"
<<<<<<< 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)"
"{"
"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;"
"}"
<<<<<<< HEAD
"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);"
"float x=h(m,y);"
"if(x<150.)"
"{"
<<<<<<< HEAD
"vec3 l=m+y*x,r=h(l);"
"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;"
"z=e(l,vec3(4,2,-15),1.,r);"
"d+=z*k;"
"d+=s*clamp(dot(r,normalize(vec3(0,1,10))),0.,1.);"
"if(g==0.)"
<<<<<<< HEAD
"d*=vec3(.3)+vec3(e(r,normalize(vec3(0,.3,.8)),normalize(y)))*.5;"
"if(g==1.)"
"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);"
"if(g==4.)"
"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.)"
"d*=p;"
"}"
"d=mix(d,mix(a,c,pow(max(dot(y,vec3(0,-.1,-1)),0.),8.)),1.-exp(-x*.01));"
"d=w(d);"
<<<<<<< HEAD
"return t(d);"
"}"
"void main()"
"{"
"vec2 m=(gl_FragCoord.xy*2.-v.xy)/v.y;"
"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_