aboutsummaryrefslogtreecommitdiff
path: root/src/client/shadows/shadowsshadercallbacks.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-03-31 22:40:06 +0200
committerGitHub <noreply@github.com>2022-03-31 22:40:06 +0200
commit31578303a4eab6b6b083e57b6bf8d12ff3b3d991 (patch)
tree3ff56df6e29207c1ca3f2f93c5327f1cc786a7ec /src/client/shadows/shadowsshadercallbacks.cpp
parent06d197cdd042392e1551e5e7244c61300a6bb4e3 (diff)
downloadminetest-31578303a4eab6b6b083e57b6bf8d12ff3b3d991.tar.gz
minetest-31578303a4eab6b6b083e57b6bf8d12ff3b3d991.tar.bz2
minetest-31578303a4eab6b6b083e57b6bf8d12ff3b3d991.zip
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
Diffstat (limited to 'src/client/shadows/shadowsshadercallbacks.cpp')
-rw-r--r--src/client/shadows/shadowsshadercallbacks.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/shadows/shadowsshadercallbacks.cpp b/src/client/shadows/shadowsshadercallbacks.cpp
index 65a63f49c..51ea8aa93 100644
--- a/src/client/shadows/shadowsshadercallbacks.cpp
+++ b/src/client/shadows/shadowsshadercallbacks.cpp
@@ -33,4 +33,10 @@ void ShadowDepthShaderCB::OnSetConstants(
m_max_far_setting.set(&MaxFar, services);
s32 TextureId = 0;
m_color_map_sampler_setting.set(&TextureId, services);
+ f32 bias0 = PerspectiveBiasXY;
+ m_perspective_bias0.set(&bias0, services);
+ f32 bias1 = 1.0f - bias0 + 1e-5f;
+ m_perspective_bias1.set(&bias1, services);
+ f32 zbias = PerspectiveBiasZ;
+ m_perspective_zbias.set(&zbias, services);
}