1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Adjust shadowmap distortion to use entire SM texture (#12166)

This commit is contained in:
x2048 2022-04-07 22:13:50 +02:00 committed by GitHub
parent 0b5b2b2633
commit 48f7c5603e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 159 additions and 115 deletions

View file

@ -220,6 +220,7 @@ class MainShaderConstantSetter : public IShaderConstantSetter
CachedPixelShaderSetting<f32> m_shadow_strength;
CachedPixelShaderSetting<f32> m_time_of_day;
CachedPixelShaderSetting<f32> m_shadowfar;
CachedPixelShaderSetting<f32, 4> m_camera_pos;
CachedPixelShaderSetting<s32> m_shadow_texture;
CachedVertexShaderSetting<f32> m_perspective_bias0_vertex;
CachedPixelShaderSetting<f32> m_perspective_bias0_pixel;
@ -252,6 +253,7 @@ public:
, m_shadow_strength("f_shadow_strength")
, m_time_of_day("f_timeofday")
, m_shadowfar("f_shadowfar")
, m_camera_pos("CameraPos")
, m_shadow_texture("ShadowMapSampler")
, m_perspective_bias0_vertex("xyPerspectiveBias0")
, m_perspective_bias0_pixel("xyPerspectiveBias0")
@ -321,6 +323,10 @@ public:
f32 shadowFar = shadow->getMaxShadowFar();
m_shadowfar.set(&shadowFar, services);
f32 cam_pos[4];
shadowViewProj.transformVect(cam_pos, light.getPlayerPos());
m_camera_pos.set(cam_pos, services);
// I dont like using this hardcoded value. maybe something like
// MAX_TEXTURE - 1 or somthing like that??
s32 TextureLayerID = 3;