Mech balancing / Less glitchy menu shader

This commit is contained in:
Anuken
2018-09-03 13:33:40 -04:00
parent bb59f45ba6
commit e877310d85
6 changed files with 13 additions and 18 deletions
+7 -7
View File
@@ -14,20 +14,20 @@ varying vec4 v_color;
varying vec2 v_texCoord;
void main() {
vec2 coords = ((v_texCoord.xy - u_uv) / (u_uv2 - u_uv) - vec2(0.5, 0.5)) * u_resolution/u_scl;
ivec2 coords = ivec2((gl_FragCoord.xy - u_resolution/2.0)/u_scl);
float roundx = 8.0;
float roundy = roundx;
int roundx = 8;
int roundy = roundx;
float roundm = 0.2;
coords.x = float(int(coords.x / roundx)) * roundx;
coords.y = float(int(coords.y / roundy)) * roundy;
coords.x = (coords.x / roundx) * roundx;
coords.y = (coords.y / roundy) * roundy;
float d = abs(coords.x) - abs(coords.y);
float d = (abs(float(coords.x)) - abs(float(coords.y)));
float m = abs(sin(-u_time/50.0 + d/120.0));
m = float(int(m / roundm)) * roundm + roundm;
gl_FragColor.rgb = mix(v_color.rgb, vec3(0.0), m);
gl_FragColor.a = mod(abs(coords.x) + abs(coords.y), 110.0) < 35.0 ? 1.0 : 0.0;
gl_FragColor.a = mod(abs(float(coords.x)) + abs(float(coords.y)), 110.0) < 35.0 ? 1.0 : 0.0;
}