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:
parent
0b5b2b2633
commit
48f7c5603e
12 changed files with 159 additions and 115 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue