LLL week18
attribute float displacement;
varying vec3 vPosition;
varying vec2 vUvCoords;
varying vec3 vNormal;
uniform float time;
uniform float mousex;
uniform float mousey;
uniform float index;
void main() {
vPosition = position;
vUvCoords = uv;
vNormal = normal;
vec3 newPosition = vec3(position);
newPosition.z = position.z * 100.0 + cos(index*-0.5+time+ mousex*5.2)*3.0 ;
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
}
varying vec3 vPosition;
varying vec2 vUvCoords;
varying vec3 vNormal;
uniform float mousex;
uniform float mousey;
uniform float time;
float usin(float value) {
return sin(value * 6.2831853)*0.5 + 0.5;
}
float noise(vec2 pos, float time) {
pos.x += usin(pos.y * 0.1 + 0.001) ;
pos.y += usin(0.001);
float valueX = 0.0;
valueX += usin(pos.x + time * 0.01 + usin(pos.y * 0.5 + 0.1) * 0.05);
valueX += usin(pos.y + 1.0 + usin(pos.y * 0.5 + time * 0.1) * usin(pos.x * 0.05)* 0.05) ;
valueX /= 2.0;
float valueY = 0.0;
valueY += usin(pos.x + usin(pos.x * 0.5+ 0.2)*0.05);
valueY += usin(pos.y * 0.1 + usin(pos.x * 0.1 + time * 0.1) * usin(pos.y * 0.05)* 0.05);
valueY /= 2.0;
float value = valueX * valueY;
return value;
}
void main() {
vec4 outputColor = vec4(1.0, 1.0, 1.0, 1.0);
float centerDist = distance(vUvCoords, vec2(0.0, 0.0));
float centerAngle = atan(vUvCoords.y, vUvCoords.x);
float centerAngleAmount = fract (centerAngle / (3.14159 / 2.0));
outputColor *= clamp(centerAngleAmount*2.0-0.1, 0.0, 1.0);
//gl_FragColor = vec4( mod(vUvCoords.y * 10.0, 1.0), vNormal.x, mod(vUvCoords.x * 10.0, 2.0), 1.0);
gl_FragColor = outputColor;
}