first commit
This commit is contained in:
51
shader/bg.frag
Normal file
51
shader/bg.frag
Normal file
@@ -0,0 +1,51 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec2 uViewport;
|
||||
uniform float uMajorStep;
|
||||
uniform float uMinorStep;
|
||||
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);
|
||||
float line = 1.0 - min(min(q.x, q.y), 1.0);
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
minorStrength = 0.22;
|
||||
majorStrength = 0.35;
|
||||
vignettePow = 0.12;
|
||||
vignetteStrength = 0.35;
|
||||
|
||||
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);
|
||||
|
||||
vec2 p = uv * 2.0 - 1.0;
|
||||
float v = clamp(1.0 - dot(p, p) * 0.12 , 0.0, 1.0);
|
||||
col *= mix(1.0, v, 0.35);
|
||||
|
||||
FragColor = vec4(col, 1.0);
|
||||
}
|
||||
7
shader/bg.vert
Normal file
7
shader/bg.vert
Normal file
@@ -0,0 +1,7 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec2 aPos;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(aPos, 0.0, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user