From 31578303a4eab6b6b083e57b6bf8d12ff3b3d991 Mon Sep 17 00:00:00 2001 From: x2048 Date: Thu, 31 Mar 2022 22:40:06 +0200 Subject: Tune shadow perspective distortion (#12146) * Pass perspective distortion parameters as uniforms * Set all perspective bias parameters via ShadowRenderer * Recalibrate perspective distortion and shadow range to render less shadow geometry with the same quality and observed shadow distance --- src/client/shadows/shadowsshadercallbacks.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/client/shadows/shadowsshadercallbacks.h') diff --git a/src/client/shadows/shadowsshadercallbacks.h b/src/client/shadows/shadowsshadercallbacks.h index 3549567c3..d00f59c37 100644 --- a/src/client/shadows/shadowsshadercallbacks.h +++ b/src/client/shadows/shadowsshadercallbacks.h @@ -30,7 +30,10 @@ public: m_light_mvp_setting("LightMVP"), m_map_resolution_setting("MapResolution"), m_max_far_setting("MaxFar"), - m_color_map_sampler_setting("ColorMapSampler") + m_color_map_sampler_setting("ColorMapSampler"), + m_perspective_bias0("xyPerspectiveBias0"), + m_perspective_bias1("xyPerspectiveBias1"), + m_perspective_zbias("zPerspectiveBias") {} void OnSetMaterial(const video::SMaterial &material) override {} @@ -39,10 +42,14 @@ public: s32 userData) override; f32 MaxFar{2048.0f}, MapRes{1024.0f}; + f32 PerspectiveBiasXY {0.9f}, PerspectiveBiasZ {0.5f}; private: CachedVertexShaderSetting m_light_mvp_setting; CachedVertexShaderSetting m_map_resolution_setting; CachedVertexShaderSetting m_max_far_setting; CachedPixelShaderSetting m_color_map_sampler_setting; + CachedVertexShaderSetting m_perspective_bias0; + CachedVertexShaderSetting m_perspective_bias1; + CachedVertexShaderSetting m_perspective_zbias; }; -- cgit v1.2.3