https://codepen.io/numerhero/pen/WmLexj
vec3 rgba2rgb (vec4 source, vec3 bgColor) {
vec3 result = vec3(0.);
result.r = ((1. - source.a) * bgColor.r) + (source.a * source.r);
result.g = ((1. - source.a) * bgColor.g) + (source.a * source.g);
result.b = ((1. - source.a) * bgColor.b) + (source.a * source.b);
return result;
}
vec2 tile (vec2 _st, float _zoom) {
_st *= _zoom;
return fract(_st);
}
float rect (vec2 st, float t, float r, float b, float l) {
vec3 color_default = vec3(1.);
float pct = step(t, 1. - st.y) * step(r, 1.0 - st.x) * step(b, st.y) * step(l, st.x);
return pct;
}
float cross (vec2 st, vec2 offset, vec2 lineThickness) {
return rect(st, 0., 1. - offset.x - lineThickness.x , 0., offset.x) +
rect(st, 1. - offset.y - lineThickness.y, 0., offset.y ,0.);
}