16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 18:19:19 +02:00

Specgloss shaders improvements + experimental SSAO (debug only)

This commit is contained in:
2026-04-21 00:25:29 +02:00
parent 6177cfb01d
commit bc0e4a9e62
17 changed files with 326 additions and 112 deletions

View File

@@ -13,3 +13,16 @@ vec3 envmap_color( vec3 normal )
#endif
return envcolor;
}
// Roughness-aware env map lookup — uses mip levels for blurry reflections.
// lod 0.0 = mirror sharp, lod ~8.0 = fully diffuse blur.
vec3 envmap_color_lod(vec3 fragnormal, float lod)
{
#if ENVMAP_ENABLED
vec3 refvec = reflect(f_pos.xyz, fragnormal); // view space — matches envmap_color exactly
refvec = vec3(inv_view * vec4(refvec, 0.0)); // world space — was missing
return textureLod(envmap, refvec, lod).rgb;
#else
return vec3(0.5); // was vec3(0.0), match the non-LOD fallback
#endif
}