Author: Not specified Language: glsl
Description: Not specified Timestamp: 2017-08-29 06:56:59 +0000
View raw paste Reply
  1. precision highp float;
  2. varying vec4 vertexPosition;
  3. void main(void) {
  4.   vec2 localPos = vec2(mod(vertexPosition.x , 0.1) - .05, mod(vertexPosition.y, 0.11) - (.11/2.0));
  5.   float polarTheta = atan(localPos.y, localPos.x);
  6.   float radius = pow(pow(localPos.x, 2.0) + pow(localPos.y, 2.0), 1.0 / 2.0) * 65.0;
  7.   float polarFunctionRadius =  sin(polarTheta) * (sqrt(abs(cos(polarTheta))) / (sin(polarTheta) + 1.4)) - 2.0 * sin(polarTheta) + 2.0;
  8.   vec4 circleColor;
  9.   if (radius < polarFunctionRadius) {
  10.     circleColor = vec4(1.0, 1.0, 1.0, 1.0);
  11.   } else {
  12.     circleColor = vec4(0.0, 0.0, 0.0, 1.0);
  13.   }
  14.   gl_FragColor = vec4((1.0 - vertexPosition.y) * circleColor.r, 0.0, abs(vertexPosition.y) * circleColor.b, 1.0);
  15. }
View raw paste Reply