lyhyemmät musat

This commit is contained in:
2024-07-29 19:33:06 +03:00
parent 7fbe712d53
commit f8371d479f
9 changed files with 228 additions and 246 deletions

View File

@ -4,7 +4,7 @@
* Contact: tdmaav@gmail.com
*/
//precision mediump float;
precision mediump float;
uniform vec2 u_resolution;
uniform float u_time;
const float PI = 22./7.;
@ -91,8 +91,8 @@ const vec3 glyph7Pos = vec3(1.7 * -1.,-1.1,0.0);
*/
// DELAYS
float STARTDELAY = 9.,
glyphPhase = 2.;
float STARTDELAY = 9.;
// COLORS
vec3 fogColor1 = vec3(.4, .2, .4), // fog color1
@ -102,7 +102,7 @@ light1Color = vec3(.9, .5, .7),
light2Color = vec3(.8, .7, .5),
chevronColor = vec3(.9, .3, 0.),
SEA_BASE = vec3(0.0, 0.1, 0.2),
SEA_WATER_COLOR =vec3(0.8,0.9,0.6)*0.6;
SEA_WATER_COLOR =vec3(0.4,0.5,0.3);
// with duration d, startTime s and speed up with timeFact
@ -119,7 +119,7 @@ float calcFactor (float startTime)
// Animate ring movements
vec3 ringAnim(vec3 p) {
for (float i = 0.; i < 7.; i++) {
float rotateDelay = STARTDELAY + (i * glyphPhase), o=1.;
float rotateDelay = STARTDELAY + (i * 2.), o=1.;
if(u_time > rotateDelay) {
if(mod(i,2.) >= 1.) o = -1.;
p.xy *= rot2D(calcFactor(rotateDelay)*o);
@ -182,7 +182,7 @@ vec2 map(vec3 p, int displace)
if (i == 7.) anRot -= .2;
q.xy = rot2D(anRot) * q.xy;
float rotateDelay = STARTDELAY + (i - 1.) * glyphPhase + 1.5;
float rotateDelay = STARTDELAY + (i - 1.) * 2. + 1.5;
// We can now call each prism by it's index
// draw all except the middle bottom prism
if (i > 0.) {
@ -236,9 +236,9 @@ 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 - (u_time*3.0 - 3.0*23.0)),0.,2.3)), cs);
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));
d = min(d, d2);
if (d==d2) mat = 1.0;
@ -325,6 +325,7 @@ vec3 postProcess(vec3 col) {
col = pow( col, vec3(.4545) );
// Contrast = a
col = smoothstep(0., 1., col);
return col;
}
@ -336,8 +337,8 @@ 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., -1., 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;
}
@ -346,7 +347,8 @@ 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,.1,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;
}
@ -391,21 +393,21 @@ vec3 sceneGate(vec2 uv)
if(mat==0.)
col *= vec3(.3) + vec3(specular(n,normalize(vec3(0.0,0.3,0.8)),normalize(rd),60.0))*0.5;
else 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));
}
else 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);
else 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);
else 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;
else if(mat ==5.)
if(mat ==5.)
col *= chevronColor; // activated glyph color
}
col = applyFog(col, d, rd, vec3(0., -.1, -1.), .01);
col = colorFlashesAnim(col); // animated color flash
col = colorFlashesAnim(col); // animated color flash
return postProcess(col);
}