summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-05 13:38:24 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-05 13:38:24 +0200
commitd935235e9c87780cef791ea9f640a5d9c2f6f513 (patch)
treee8cc4474abff1c5fd943f64ddb42daad7129cf6c /servers
parentec2bda3c5bf5ec3caf21d40bfe1c6772c8f6ba3a (diff)
parentaba356e882d498ada7f4443afd6ddcf7ace2c9bf (diff)
Merge pull request #66922 from BastiaanOlij/fix_direct_shadow
Make sure atlas rect for directional lights is calculated using floats
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp10
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp10
2 files changed, 10 insertions, 10 deletions
diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
index cf08949d99..69d444aeeb 100644
--- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp
@@ -2174,11 +2174,11 @@ void RenderForwardClustered::_render_shadow_pass(RID p_light, RID p_shadow_atlas
}
}
- int directional_shadow_size = light_storage->directional_shadow_get_size();
- atlas_rect.position /= directional_shadow_size;
- atlas_rect.size /= directional_shadow_size;
-
- light_storage->light_instance_set_directional_shadow_atlas_rect(p_light, p_pass, atlas_rect);
+ float directional_shadow_size = light_storage->directional_shadow_get_size();
+ Rect2 atlas_rect_norm = atlas_rect;
+ atlas_rect_norm.position /= directional_shadow_size;
+ atlas_rect_norm.size /= directional_shadow_size;
+ light_storage->light_instance_set_directional_shadow_atlas_rect(p_light, p_pass, atlas_rect_norm);
zfar = RSG::light_storage->light_get_param(base, RS::LIGHT_PARAM_RANGE);
diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
index c3ce1b05f1..2b2090f8ed 100644
--- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
+++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp
@@ -1128,11 +1128,11 @@ void RenderForwardMobile::_render_shadow_pass(RID p_light, RID p_shadow_atlas, i
}
}
- int directional_shadow_size = light_storage->directional_shadow_get_size();
- atlas_rect.position /= directional_shadow_size;
- atlas_rect.size /= directional_shadow_size;
-
- light_storage->light_instance_set_directional_shadow_atlas_rect(p_light, p_pass, atlas_rect);
+ float directional_shadow_size = light_storage->directional_shadow_get_size();
+ Rect2 atlas_rect_norm = atlas_rect;
+ atlas_rect_norm.position /= directional_shadow_size;
+ atlas_rect_norm.size /= directional_shadow_size;
+ light_storage->light_instance_set_directional_shadow_atlas_rect(p_light, p_pass, atlas_rect_norm);
zfar = RSG::light_storage->light_get_param(base, RS::LIGHT_PARAM_RANGE);