first commit

This commit is contained in:
David Ali
2026-01-09 13:50:52 +01:00
commit 9f87935db1
24 changed files with 7925 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#version 450 core
layout(location = 0) out vec4 oColor;
layout(std140, binding = 0) uniform PerFrame {
mat4 uView;
mat4 uProj;
vec4 uLightDir; // unused
};
layout(std140, binding = 2) uniform Material {
vec4 uAlbedo; // unused
};
layout(location = 0) in vec3 vDir;
// sRGB-tuned colors; well convert to linear before mixing
vec3 srgb2lin(vec3 c){ return pow(c, vec3(2.2)); }
vec3 lin2srgb(vec3 c){ return pow(c, vec3(1.0/2.2)); }
void main() {
// nicer defaults (tweak to taste)
vec3 skyTopL = srgb2lin(vec3(0.15, 0.35, 0.75));
vec3 skyHorizonL = srgb2lin(vec3(0.75, 0.85, 0.98));
vec3 dir = normalize(vDir);
float t = clamp(dir.z * 0.5 + 0.5, 0.0, 1.0); // (B) world up = +Z
// shape the gradient a bit
t = pow(t, 1.45);
vec3 colorL = mix(skyHorizonL, skyTopL, t);
oColor = vec4(lin2srgb(colorL), 1.0); // manual gamma (your default FB isnt sRGB)
}