1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00: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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 117 additions and 59 deletions

View file

@ -90,6 +90,9 @@ public:
float getShadowStrength() const { return m_shadows_enabled ? m_shadow_strength : 0.0f; }
float getTimeOfDay() const { return m_time_day; }
f32 getPerspectiveBiasXY() { return m_perspective_bias_xy; }
f32 getPerspectiveBiasZ() { return m_perspective_bias_z; }
private:
video::ITexture *getSMTexture(const std::string &shadow_map_name,
video::ECOLOR_FORMAT texture_format,
@ -131,6 +134,8 @@ private:
bool m_shadow_map_colored;
u8 m_map_shadow_update_frames; /* Use this number of frames to update map shaodw */
u8 m_current_frame{0}; /* Current frame */
f32 m_perspective_bias_xy;
f32 m_perspective_bias_z;
video::ECOLOR_FORMAT m_texture_format{video::ECOLOR_FORMAT::ECF_R16F};
video::ECOLOR_FORMAT m_texture_format_color{video::ECOLOR_FORMAT::ECF_R16G16};
@ -146,6 +151,7 @@ private:
s32 mixcsm_shader{-1};
ShadowDepthShaderCB *m_shadow_depth_cb{nullptr};
ShadowDepthShaderCB *m_shadow_depth_entity_cb{nullptr};
ShadowDepthShaderCB *m_shadow_depth_trans_cb{nullptr};
shadowScreenQuad *m_screen_quad{nullptr};