From 7c01d279191206668558d0e33142d1b1bd9b29fc Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:23:48 -0400 Subject: [PATCH] Tweak high terrain shader shadow calculations --- data/base/shaders/terrain_combined_high.frag | 3 +-- data/base/shaders/vk/terrain_combined_high.frag | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/data/base/shaders/terrain_combined_high.frag b/data/base/shaders/terrain_combined_high.frag index ba5549f73f7..1bab7ef480e 100644 --- a/data/base/shaders/terrain_combined_high.frag +++ b/data/base/shaders/terrain_combined_high.frag @@ -127,12 +127,11 @@ vec4 doBumpMapping(BumpData b, vec3 lightDir, vec3 halfVec) { blinnTerm = lambertTerm != 0.0 ? blinnTerm : 0.0; blinnTerm = pow(blinnTerm, 16.f); float visibility = getShadowVisibility(); - visibility = visibility*visibility*visibility; vec4 lightmap_vec4 = texture(lightmap_tex, uvLightmap, 0.f); float adjustedTileBrightness = pow(lightmap_vec4.a, 2.f-lightmap_vec4.a); // ... * tile brightness / ambient occlusion (stored in lightmap.a) - vec4 light = (ambientLight + visibility*diffuseLight*lambertTerm) * adjustedTileBrightness; + vec4 light = (ambientLight*0.25f + visibility*ambientLight*0.75f + visibility*diffuseLight*lambertTerm) * adjustedTileBrightness; light.rgb = blendAddEffectLighting(light.rgb, (lightmap_vec4.rgb / 1.5f)); // additive color (from environmental point lights / effects) vec4 light_spec = (visibility*specularLight*blinnTerm*lambertTerm) * adjustedTileBrightness; diff --git a/data/base/shaders/vk/terrain_combined_high.frag b/data/base/shaders/vk/terrain_combined_high.frag index 2a8c295d6cf..950e031af3e 100644 --- a/data/base/shaders/vk/terrain_combined_high.frag +++ b/data/base/shaders/vk/terrain_combined_high.frag @@ -69,12 +69,11 @@ vec4 doBumpMapping(BumpData b, vec3 lightDir, vec3 halfVec) { blinnTerm = lambertTerm != 0.0 ? blinnTerm : 0.0; blinnTerm = pow(blinnTerm, 16.f); float visibility = getShadowVisibility(); - visibility = visibility*visibility*visibility; vec4 lightmap_vec4 = texture(lightmap_tex, frag.uvLightmap, 0.f); float adjustedTileBrightness = pow(lightmap_vec4.a, 2.f-lightmap_vec4.a); // ... * tile brightness / ambient occlusion (stored in lightmap.a) - vec4 light = (ambientLight + visibility*diffuseLight*lambertTerm) * adjustedTileBrightness; + vec4 light = (ambientLight*0.25f + visibility*ambientLight*0.75f + visibility*diffuseLight*lambertTerm) * adjustedTileBrightness; light.rgb = blendAddEffectLighting(light.rgb, (lightmap_vec4.rgb / 1.5f)); // additive color (from environmental point lights / effects) vec4 light_spec = (visibility*specularLight*blinnTerm*lambertTerm) * adjustedTileBrightness;