improve rendering of the grid

Fri, 04 Mar 2022 23:41:58 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 04 Mar 2022 23:41:58 +0200
changeset 155
13713fadbf14
parent 154
47cb50cfa9ad
child 156
65b75beed7e0

improve rendering of the grid

src/gl/gridprogram.cpp file | annotate | diff | comparison | revisions
--- a/src/gl/gridprogram.cpp	Fri Mar 04 23:00:06 2022 +0200
+++ b/src/gl/gridprogram.cpp	Fri Mar 04 23:41:58 2022 +0200
@@ -52,12 +52,12 @@
 	/* compute distance to nearest unit line */
 	float d = min(min(min(dy, dx), 1 - dy), 1 - dx);
 	/* use an extreme sigmoid to bring out the grid shape */
-	d = pow(1 - d, 50);
+	d = pow(1.02 - d, 100);
 	/* fade the grid towards extreme co-ordinates */
 	d = (1.0f - 20 * max(abs(ex_uv.x), abs(ex_uv.y))) * d;
 	/* add dashes */
-	d *= (1 + cos(ex_uv.y / 0.0001f * pi)) * 0.5f;
-	d *= (1 + cos(ex_uv.x / 0.0001f * pi)) * 0.5f;
+	d *= (1 + pow(cos((ex_uv.y / 0.0001f) * pi), 10)) * 0.5f;
+	d *= (1 + pow(cos((ex_uv.x / 0.0001f) * pi), 10)) * 0.5f;
 	color = vec4(gridColor.xyz, gridColor.w * d);
 }
 )";

mercurial