From 166bd83fe0ee12e33b5a399af5c76959b604bb08 Mon Sep 17 00:00:00 2001 From: PHO Date: Wed, 26 Dec 2018 22:40:43 +0900 Subject: [PATCH] Make edges of shadows a bit sharper (#23) --- src/shaders/glsl/natural-mystic-utils.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shaders/glsl/natural-mystic-utils.h b/src/shaders/glsl/natural-mystic-utils.h index add269c..41a1c65 100644 --- a/src/shaders/glsl/natural-mystic-utils.h +++ b/src/shaders/glsl/natural-mystic-utils.h @@ -114,12 +114,16 @@ vec3 applyShadow(vec3 frag, float torchLevel, float sunLevel, float daylight, fl const vec3 shadowColor = vec3(0.0); const float minShadow = 0.0; // [0, 1] const float maxShadow = 0.45; // [0, 1] + const float blur = 0.003; // The higher the more blur. const float torchLightCutOff = 0.1; // [0, 1] /* The less the sunlight level is, the darker the fragment will * be. */ float density = mix(maxShadow, minShadow, - smoothstep(0.865, 0.875, sunLevel)); + smoothstep( + 0.870 - blur, + 0.870 + blur, + sunLevel)); if (density > 0.0) { /* The existence of torch light should negate the effect of