Browse Source

some shader tweaks making the time go round and round

main
heck 2 years ago
parent
commit
760c3a2b4e
  1. 43
      html/index.html

43
html/index.html

@ -66,29 +66,30 @@
vec2 f = pos.xy - i;
vec2 blend = f * f * (3.0 -(2.0 * f));
float noiseVal =
mix(
mix(
dot(GetGradient(i + vec2(0, 0), pos.z), f - vec2(0, 0)),
dot(GetGradient(i + vec2(1, 0), pos.z), f - vec2(1, 0)),
blend.x),
mix(
dot(GetGradient(i + vec2(0, 1), pos.z), f - vec2(0, 1)),
dot(GetGradient(i + vec2(1, 1), pos.z), f - vec2(1, 1)),
blend.x),
blend.y
);
return noiseVal / 0.7;// normalize to about [-1..1]
mix(
mix(
dot(GetGradient(i + vec2(0, 0), pos.z), f - vec2(0, 0)),
dot(GetGradient(i + vec2(1, 0), pos.z), f - vec2(1, 0)),
blend.x),
mix(
dot(GetGradient(i + vec2(0, 1), pos.z), f - vec2(0, 1)),
dot(GetGradient(i + vec2(1, 1), pos.z), f - vec2(1, 1)),
blend.x),
blend.y
);
return noiseVal / 0.7;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.y;
float time = iTime * (iTime * 0.1);
vec2 uvm = iMouse.xy / iResolution.y;
float noiseVal = 0.5 + 0.5 * Pseudo3dNoise(vec3(uv *6.0, time/10.));
float time = (80.-(1.*uvm.y)) * sin(iTime / 30000.);
float noiseVal = 0.5 + 0.1 + (time/100.) * Pseudo3dNoise(vec3(uv * (6. + (0.07 * uvm.x)), time/10.));
float val = sin(noiseVal * time + (sin(time) * time / 10.));
fragColor.rgba = vec4(val, val, val, 1.);
fragColor.rgba = vec4(vec3(val), 1.0);
}
void main() {
@ -99,8 +100,6 @@
<style>
body {
background-color: black;
}
.shaderhero {
@ -118,7 +117,7 @@
z-index: -100;
width: 100%;
height: 100%;
opacity: 1.
opacity: 0.9;
}
.shadercontainer {
@ -231,8 +230,8 @@
function onPointerMove(event) {
var clientX = event.clientX;
var clientY = event.clientY;
var mouseX = clientX / window.innerWidth;
var mouseY = 1 - clientY / window.innerHeight;
var mouseX = clientX;
var mouseY = 1 - clientY;
uniforms[ 'iMouse' ].value = new THREE.Vector2(mouseX, mouseY);
}
@ -255,7 +254,7 @@
uniforms['iResolution'].value = new THREE.Vector2( canvas.clientWidth / downsample_quality, canvas.clientHeight / downsample_quality );
}
uniforms[ 'iTime' ].value = performance.now() / 1000;
uniforms[ 'iTime' ].value = performance.now();
renderer.render( scene, camera );
}

Loading…
Cancel
Save