diff options
author | x2048 <codeforsmile@gmail.com> | 2021-10-01 16:21:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 16:21:53 +0200 |
commit | 982e03f60dc95cb2605a4a1c6520b604f85dd1d0 (patch) | |
tree | 748a4763dea169f7e983a602a1fc7d2e031c9849 /client/shaders/nodes_shader | |
parent | 21113ad4105dd3fb181b3d0638b907af94a352ab (diff) | |
download | minetest-982e03f60dc95cb2605a4a1c6520b604f85dd1d0.tar.gz minetest-982e03f60dc95cb2605a4a1c6520b604f85dd1d0.tar.bz2 minetest-982e03f60dc95cb2605a4a1c6520b604f85dd1d0.zip |
Improvements to colored shadows (#11516)
Diffstat (limited to 'client/shaders/nodes_shader')
-rw-r--r-- | client/shaders/nodes_shader/opengl_fragment.glsl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl index 87ef9af7d..e21890710 100644 --- a/client/shaders/nodes_shader/opengl_fragment.glsl +++ b/client/shaders/nodes_shader/opengl_fragment.glsl @@ -489,7 +489,11 @@ void main(void) if (distance_rate > 1e-7) { #ifdef COLORED_SHADOWS - vec4 visibility = getShadowColor(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); + vec4 visibility; + if (cosLight > 0.0) + visibility = getShadowColor(ShadowMapSampler, posLightSpace.xy, posLightSpace.z); + else + visibility = vec4(1.0, 0.0, 0.0, 0.0); shadow_int = visibility.r; shadow_color = visibility.gba; #else @@ -507,7 +511,8 @@ void main(void) shadow_int = 1.0 - (shadow_int * f_adj_shadow_strength); - col.rgb = mix(shadow_color,col.rgb,shadow_int)*shadow_int; + // apply shadow (+color) as a factor to the material color + col.rgb = col.rgb * (1.0 - (1.0 - shadow_color) * (1.0 - pow(shadow_int, 2.0))); // col.r = 0.5 * clamp(getPenumbraRadius(ShadowMapSampler, posLightSpace.xy, posLightSpace.z, 1.0) / SOFTSHADOWRADIUS, 0.0, 1.0) + 0.5 * col.r; #endif |