Last active
August 29, 2015 14:00
-
-
Save kw0006667/11269234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 pointMain[225]; | |
uniform int pointNumber; | |
float Blob(vec2 position, vec2 point, float radius) | |
{ | |
float temp = pow(position.x - point.x, 2.0) + pow(position.y - point.y, 2.0); | |
float result = 0.0; | |
if(temp < pow(radius, 2.0)) | |
{ | |
float distance = sqrt(pow(position.x - point.x, 2.0) + pow(position.y - point.y, 2.0)) / radius; | |
result = pow((1.0 - pow(distance, 2.0)), 2.0); | |
} | |
return result; | |
} | |
void main(void) | |
{ | |
float PI = 3.141516; | |
vec2 position = gl_FragCoord.xy / vec2(800, 600); | |
float radius = 0.06; | |
float blobValue = 0.0; | |
for (int i = 0; i < pointNumber; i++) | |
{ | |
blobValue += Blob(position, pointMain[i], radius); | |
} | |
vec4 color = vec4(92 / 255.0, 186 / 255.0, 231 / 255.0, blobValue); | |
gl_FragColor = color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment