stretch the grid quadrilateral less, hopefully this makes fragments small enough even on integrated

Fri, 06 Mar 2020 23:45:44 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Fri, 06 Mar 2020 23:45:44 +0200
changeset 72
7c27cda03747
parent 71
198d25fe4e21
child 73
97df974b5ed5

stretch the grid quadrilateral less, hopefully this makes fragments small enough even on integrated

src/gl/gridprogram.cpp file | annotate | diff | comparison | revisions
--- a/src/gl/gridprogram.cpp	Fri Mar 06 21:53:30 2020 +0200
+++ b/src/gl/gridprogram.cpp	Fri Mar 06 23:45:44 2020 +0200
@@ -27,7 +27,7 @@
 uniform mat4 projection;
 uniform mat4 model;
 smooth out vec2 ex_uv;
-const mat4 stretch = mat4(vec4(10000, 0, 0, 0), vec4(0, 10000, 0, 0), vec4(0, 0, 10000, 0), vec4(0, 0, 0, 1));
+const mat4 stretch = mat4(vec4(1000, 0, 0, 0), vec4(0, 1000, 0, 0), vec4(0, 0, 1000, 0), vec4(0, 0, 0, 1));
 uniform mat4 grid;
 
 void main()
@@ -47,8 +47,8 @@
 
 void main(void)
 {
-	float dx = fract(ex_uv.y / 0.0001f);
-	float dy = fract(ex_uv.x / 0.0001f);
+	float dx = fract(ex_uv.y / 0.001f);
+	float dy = fract(ex_uv.x / 0.001f);
 	/* 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 */
@@ -56,8 +56,8 @@
 	/* 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.00001f * pi)) * 0.5f;
-	d *= (1 + cos(ex_uv.x / 0.00001f * pi)) * 0.5f;
+	d *= (1 + cos(ex_uv.y / 0.0001f * pi)) * 0.5f;
+	d *= (1 + cos(ex_uv.x / 0.0001f * pi)) * 0.5f;
 	color = vec4(gridColor.xyz, gridColor.w * d);
 }
 )";

mercurial