Skip to content

Commit

Permalink
Fix the logic of the point light sphere vs mesh obb test
Browse files Browse the repository at this point in the history
If they do not intersect, then the mesh is not relevant for the light.
  • Loading branch information
superdump committed Sep 23, 2021
1 parent 04e3f24 commit a5e2f40
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pipelined/bevy_pbr2/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ pub fn check_light_visibility(
// If we have an aabb and transform, do frustum culling
if let (Some(aabb), Some(transform)) = (maybe_aabb, maybe_transform) {
let model_to_world = transform.compute_matrix();
// Do a cheap sphere vs obb test to prune out most meshes
if light_sphere.intersects_obb(aabb, &model_to_world) {
// Do a cheap sphere vs obb test to prune out most meshes outside the sphere of the light
if !light_sphere.intersects_obb(aabb, &model_to_world) {
continue;
}
for (frustum, visible_entities) in cubemap_frusta
Expand Down

0 comments on commit a5e2f40

Please sign in to comment.