From 163d413f9c4c751ade24f0fb3017b51a9158cf3a Mon Sep 17 00:00:00 2001 From: karl Date: Sun, 23 May 2021 20:39:10 +0200 Subject: [PATCH] Minor lighting improvements --- Shader/bump.fs | 2 +- Shader/bump.vs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Shader/bump.fs b/Shader/bump.fs index 1d8d309..4bc59d5 100644 --- a/Shader/bump.fs +++ b/Shader/bump.fs @@ -86,7 +86,7 @@ float get_shadow(vec4 fragPosLightSpace, vec3 normal) { // We divide by this later, so make sure it's not exactly 0 // It seems like it should always be 0.0, but due to interpolation it's not -- it increases with the deviation! // A larger second parameter to max() means more blur (but also more light bleeding) - float variance = max(moments.y - moments.x * moments.x, (currentDepth - closestDepth) * 0.05); + float variance = max(moments.y - moments.x * moments.x, (-0.01 + (currentDepth - closestDepth) * 0.7) * 0.1); float d = projCoords.z - moments.x * 1.0; // Use linear_step to prevent light bleeding diff --git a/Shader/bump.vs b/Shader/bump.vs index 38dc13c..3b64383 100644 --- a/Shader/bump.vs +++ b/Shader/bump.vs @@ -35,7 +35,7 @@ void main() { vec3 N = normalize(mat3(model) * aNormal); mat3 TBN = transpose(mat3(T, B, N)); - vs_out.TangentLightDir = light_direction; + vs_out.TangentLightDir = TBN * -light_direction; vs_out.TangentViewPos = TBN * viewPos; vs_out.TangentFragPos = TBN * vs_out.FragPos; }