This commit is contained in:
2026-02-11 17:50:12 +08:00
parent 1bcfb49b7a
commit 26e00f9fea
6 changed files with 202 additions and 51 deletions

View File

@@ -9,9 +9,9 @@ uniform bool uLightMode;
float gridLine(float stepPx) {
vec2 coord = gl_FragCoord.xy;
vec2 q = coord / stepPx;
vec2 q = abs(fract(q - 0.5) - 0.5) / fwidth(stepPx);
vec2 q = coord / max(stepPx, 1.0);
vec2 fw = max(fwidth(q), vec2(1e-6));
q = abs(fract(q - 0.5) - 0.5) / fw;
float line = 1.0 - min(min(q.x, q.y), 1.0);
return line;
@@ -21,27 +21,24 @@ void main() {
vec2 viewport = max(uViewport, vec2(1.0));
vec2 uv = gl_FragCoord.xy / viewport;
vec3 topCol, botCol, majCol, minCol;
float majStrength, minStrength;
float vignettePow, vignetteStrength;
vec3 topCol, botCol;
float majorStrength, minorStrength;
topCol = vec3(0.99, 0.99, 1.00);
botCol = vec3(0.94, 0.95, 0.98);
minorCol = vec3(0.80, 0.82, 0.87);
majorCol = vec3(0.70, 0.73, 0.80);
vec3 minorCol = vec3(0.80, 0.82, 0.87);
vec3 majorCol = vec3(0.70, 0.73, 0.80);
minorStrength = 0.22;
majorStrength = 0.35;
vignettePow = 0.12;
vignetteStrength = 0.35;
minorStrength = 0.28;
majorStrength = 0.45;
vec3 col = mix(botCol, topCol, uv.y);
float minor = gridLine(max(uMinorStep, 1.0));
float major = gridLine(max(uMajorStep, 1.0));
col = mix(col, minorCol, minStrength * minor);
col = mix(col, majorCol, majStrength * major);
col = mix(col, minorCol, minorStrength * minor);
col = mix(col, majorCol, majorStrength * major);
vec2 p = uv * 2.0 - 1.0;
float v = clamp(1.0 - dot(p, p) * 0.12 , 0.0, 1.0);