Skip to content

Commit

Permalink
Merge pull request #66922 from BastiaanOlij/fix_direct_shadow
Browse files Browse the repository at this point in the history
Make sure atlas rect for directional lights is calculated using floats
  • Loading branch information
akien-mga committed Oct 5, 2022
2 parents ec2bda3 + aba356e commit d935235
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d935235

Please sign in to comment.