【GLSL】奥行きのあるチェッカーパターン
See the Pen checker pattern with depth by aadebdeb (@aadebdeb) on CodePen.
#define PI 3.14159265359 precision mediump float; uniform float u_time; uniform vec2 u_mouse; uniform vec2 u_resolution; vec2 transform(vec2 st) { float h = u_resolution.y / 2.0; float scale = h / st.y; return vec2(st.x * scale, scale * 100.0); } void main(void) { vec2 st = gl_FragCoord.xy - u_resolution / 2.0; float size = 20.0; st = transform(st); float c = abs(floor(mod(st.x / size, 2.0)) - floor(mod(st.y / size, 2.0))); gl_FragColor = vec4(vec3(c), 1.0); }