From e7881f1bad47aad99f054aca31f4d1db4b6b2237 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Fri, 19 Jul 2024 15:54:57 +0700 Subject: [PATCH] - [Grid] Fix uneven gap size on non uniform grid size. --- shaders/sh_grid/sh_grid.fsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shaders/sh_grid/sh_grid.fsh b/shaders/sh_grid/sh_grid.fsh index 82596a8c5..75e9c8b80 100644 --- a/shaders/sh_grid/sh_grid.fsh +++ b/shaders/sh_grid/sh_grid.fsh @@ -261,8 +261,9 @@ void main() { #region vec2 sqSt = floor(_pos * sca) / sca; vec2 _dist = _pos - sqSt; vec2 nPos = abs(_dist * sca - vec2(0.5)) * 2.; //distance in x, y axis - float dist = 1. - max(nPos.x, nPos.y); - + float rat = sca.y / sca.x; + float dist = 1. - max((nPos.x - 1.) * rat + 1., nPos.y); + vec4 colr; if(mode == 2) {