50 float dx = fract(ex_uv.y / 0.001f); |
50 float dx = fract(ex_uv.y / 0.001f); |
51 float dy = fract(ex_uv.x / 0.001f); |
51 float dy = fract(ex_uv.x / 0.001f); |
52 /* compute distance to nearest unit line */ |
52 /* compute distance to nearest unit line */ |
53 float d = min(min(min(dy, dx), 1 - dy), 1 - dx); |
53 float d = min(min(min(dy, dx), 1 - dy), 1 - dx); |
54 /* use an extreme sigmoid to bring out the grid shape */ |
54 /* use an extreme sigmoid to bring out the grid shape */ |
55 d = pow(1 - d, 50); |
55 d = pow(1.02 - d, 100); |
56 /* fade the grid towards extreme co-ordinates */ |
56 /* fade the grid towards extreme co-ordinates */ |
57 d = (1.0f - 20 * max(abs(ex_uv.x), abs(ex_uv.y))) * d; |
57 d = (1.0f - 20 * max(abs(ex_uv.x), abs(ex_uv.y))) * d; |
58 /* add dashes */ |
58 /* add dashes */ |
59 d *= (1 + cos(ex_uv.y / 0.0001f * pi)) * 0.5f; |
59 d *= (1 + pow(cos((ex_uv.y / 0.0001f) * pi), 10)) * 0.5f; |
60 d *= (1 + cos(ex_uv.x / 0.0001f * pi)) * 0.5f; |
60 d *= (1 + pow(cos((ex_uv.x / 0.0001f) * pi), 10)) * 0.5f; |
61 color = vec4(gridColor.xyz, gridColor.w * d); |
61 color = vec4(gridColor.xyz, gridColor.w * d); |
62 } |
62 } |
63 )"; |
63 )"; |
64 |
64 |
65 static const glm::vec2 data[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}}; |
65 static const glm::vec2 data[] = {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}}; |