Shayders
By Ayfri
The logo!
Image
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 uResolution;
#define PI 3.14159265359
#define PI_3 1.0471975512 // PI / 3 (60 degrees)
void main() {
// Center UVs and fix aspect ratio
vec2 uv = (gl_FragCoord.xy - 0.5 * uResolution.xy) / uResolution.y;
// Convert to polar coordinates
float a = atan(uv.y, uv.x);
float r = length(uv);
// Build flat-top hexagon shape and apply anti-aliasing
float hex = cos(PI / 6.0) / cos(mod(a, PI_3) - PI / 6.0);
float mask = 1.0 - smoothstep(0.45 * hex, 0.45 * hex + 0.005, r);
// Normalize angle to map each 60-degree slice to an index (0 to 5)
float angleNorm = mod(a - PI_3 + 2.0 * PI, 2.0 * PI);
float idx = floor(angleNorm / PI_3);
// Assign color based on slice index
vec3 color;
if (idx < 0.5) {
color = vec3(1.0, 0.23, 0.19); // Red
} else if (idx < 1.5) {
color = vec3(0.68, 0.32, 0.87); // Purple
} else if (idx < 2.5) {
color = vec3(0.0, 0.48, 1.0); // Blue
} else if (idx < 3.5) {
color = vec3(0.2, 0.78, 0.35); // Green
} else if (idx < 4.5) {
color = vec3(1.0, 0.8, 0.0); // Yellow
} else {
color = vec3(1.0, 0.58, 0.0); // Orange
}
// Output final color with mask applied for the background
gl_FragColor = vec4(color * mask, 1.0);
}