4096 tavua

This commit is contained in:
2024-07-29 18:19:39 +03:00
parent 7fbe712d53
commit 055dbd10c0
3 changed files with 177 additions and 169 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.);
@ -102,7 +97,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
@ -113,7 +108,7 @@ float timedSine(vec3 i) {
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 +151,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;
@ -237,8 +232,7 @@ vec2 map(vec3 p, int displace)
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, 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;
@ -325,6 +319,9 @@ vec3 postProcess(vec3 col) {
col = pow( col, vec3(.4545) );
// Contrast = a
col = smoothstep(0., 1., col);
// fade out at the end
col += 1.2 - vec3(clamp((37. - u_time)*.35, 0., 1.2));
return col;
}
@ -359,6 +356,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
@ -390,17 +392,17 @@ 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;
else 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));
}
else 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.)
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.)
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==2.)
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.+1e5, .3,0); // + noise(p.xz*1000.+5000., 0.1) + noise(p.xz*1000.+5000., 0.1);
if(mat==4.)
col *= vec3(.1)+ addSpecular(n,rd,0.5);
if(mat ==5.)
col *= chevronColor; // activated glyph color
}