1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-16 01:45:36 +02:00

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
This commit is contained in:
x2048
2022-03-31 22:40:06 +02:00
committed by GitHub
parent 06d197cdd0
commit 31578303a4
12 changed files with 117 additions and 59 deletions

View File

@@ -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<f32, 16> m_light_mvp_setting;
CachedVertexShaderSetting<f32> m_map_resolution_setting;
CachedVertexShaderSetting<f32> m_max_far_setting;
CachedPixelShaderSetting<s32> m_color_map_sampler_setting;
CachedVertexShaderSetting<f32> m_perspective_bias0;
CachedVertexShaderSetting<f32> m_perspective_bias1;
CachedVertexShaderSetting<f32> m_perspective_zbias;
};