final 0.1 - 4091bytes
This commit is contained in:
24
shader.glsl
24
shader.glsl
@ -143,6 +143,7 @@ vec2 map(vec3 p, int displace)
|
||||
float mat = 0.,
|
||||
// Ring boxes
|
||||
an = PI/12.,
|
||||
step,
|
||||
anRot = floor(atan(p.y,p.x)/an + .5)*an;
|
||||
vec3 q = p;
|
||||
q.xy = rot2D(anRot)*q.xy;
|
||||
@ -202,12 +203,14 @@ vec2 map(vec3 p, int displace)
|
||||
d2 = 1e3;
|
||||
float stepDist = 1.5;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
float step = sdBox2(vec3(p.x,p.y+stepDist,p.z), vec3(2., .1,stepDist)) - .05;
|
||||
step = sdBox2(vec3(p.x,p.y+stepDist,p.z), vec3(2., .1,stepDist)) - .05;
|
||||
d2 = min(d2, step);
|
||||
d = min(d, step);
|
||||
stepDist += .2;
|
||||
}
|
||||
if (d==d2) mat = 2.0;
|
||||
d2 += noise(p.xz * 50.+200., .01, 0);
|
||||
d = min(d, d2*0.7);
|
||||
if (d==d2*0.7) mat = 2.0;
|
||||
|
||||
|
||||
// sand
|
||||
d2 = (p.y + 4.25) + noise((vec2((p.x*.04),(p.z-40.)*.04))+100., 15., 0)*1.5;
|
||||
@ -316,11 +319,6 @@ vec3 postProcess(vec3 col) {
|
||||
return col;
|
||||
}
|
||||
|
||||
vec3 getCpos(float time) {
|
||||
return vec3((cos(time)-0.9)*2., -sin(time)*0.8, 5.);;
|
||||
}
|
||||
|
||||
|
||||
vec3 cameraPos()
|
||||
{
|
||||
// first zoom in to the gate
|
||||
@ -408,15 +406,15 @@ vec3 sceneGate(vec2 uv)
|
||||
|
||||
// indirect lightning -> vec3 in normalize is light direction
|
||||
col += indirColor * clamp( dot( n, normalize(vec3(0. , 1., 10.))), 0., 1.);
|
||||
|
||||
|
||||
if(mat==0.)
|
||||
col *= vec3(0.21, 0.35, 0.33) + addSpecular(n,rd,.5, 2.);
|
||||
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));
|
||||
if(mat==2.)
|
||||
col *= vec3(.8, .8, .5) + addSpecular(n,rd,.1,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(.8, .8, .5);
|
||||
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);
|
||||
col *= vec3(.8, .8, .5) + noise(p.xz*500.+1e5, .3,0);
|
||||
if(mat==4.)
|
||||
col *= vec3(0.0, 0.08, 0.11) + addSpecular(n,rd,0.3,0.7);
|
||||
if(mat ==5.)
|
||||
@ -424,7 +422,7 @@ vec3 sceneGate(vec2 uv)
|
||||
if(mat == 6.) {
|
||||
col *= vec3(0.01, 0.04, 0.06) + addSpecular(n,rd,.1, 2.5);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
col = applyFog(col, d, rd, vec3(0., -.1, -1.), .01);
|
||||
col = colorFlashesAnim(col); // animated color flash
|
||||
|
||||
Reference in New Issue
Block a user