diff options
author | x2048 <codeforsmile@gmail.com> | 2022-04-07 22:13:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 22:13:50 +0200 |
commit | 48f7c5603e5b2dfca941d228e76e452bc269a1fa (patch) | |
tree | 7983bb05e762792e38ba22a59e8718cac5381747 /src/client/shadows/dynamicshadowsrender.cpp | |
parent | 0b5b2b2633609f646a534d353a2c587af4be46fa (diff) | |
download | minetest-48f7c5603e5b2dfca941d228e76e452bc269a1fa.tar.gz minetest-48f7c5603e5b2dfca941d228e76e452bc269a1fa.tar.bz2 minetest-48f7c5603e5b2dfca941d228e76e452bc269a1fa.zip |
Adjust shadowmap distortion to use entire SM texture (#12166)
Diffstat (limited to 'src/client/shadows/dynamicshadowsrender.cpp')
-rw-r--r-- | src/client/shadows/dynamicshadowsrender.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/shadows/dynamicshadowsrender.cpp b/src/client/shadows/dynamicshadowsrender.cpp index 262711221..1dfc90d1c 100644 --- a/src/client/shadows/dynamicshadowsrender.cpp +++ b/src/client/shadows/dynamicshadowsrender.cpp @@ -158,7 +158,6 @@ void ShadowRenderer::setShadowIntensity(float shadow_intensity) disable(); } - void ShadowRenderer::addNodeToShadowList( scene::ISceneNode *node, E_SHADOW_MODE shadowMode) { @@ -261,8 +260,9 @@ void ShadowRenderer::updateSMTextures() cb->MaxFar = (f32)m_shadow_map_max_distance * BS; cb->PerspectiveBiasXY = getPerspectiveBiasXY(); cb->PerspectiveBiasZ = getPerspectiveBiasZ(); + cb->CameraPos = light.getFuturePlayerPos(); } - + // set the Render Target // right now we can only render in usual RTT, not // Depth texture is available in irrlicth maybe we @@ -322,9 +322,10 @@ void ShadowRenderer::update(video::ITexture *outputTarget) if (!m_shadow_node_array.empty() && !m_light_list.empty()) { for (DirectionalLight &light : m_light_list) { - // Static shader values. - m_shadow_depth_cb->MapRes = (f32)m_shadow_map_texture_size; - m_shadow_depth_cb->MaxFar = (f32)m_shadow_map_max_distance * BS; + // Static shader values for entities are set in updateSMTextures + // SM texture for entities is not updated incrementally and + // must by updated using current player position. + m_shadow_depth_entity_cb->CameraPos = light.getPlayerPos(); // render shadows for the n0n-map objects. m_driver->setRenderTarget(shadowMapTextureDynamicObjects, true, |