From a5e2f4089816d800e912988c00894048d311f915 Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 16 Sep 2021 14:41:11 +0200 Subject: [PATCH] Fix the logic of the point light sphere vs mesh obb test If they do not intersect, then the mesh is not relevant for the light. --- pipelined/bevy_pbr2/src/render/light.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipelined/bevy_pbr2/src/render/light.rs b/pipelined/bevy_pbr2/src/render/light.rs index 8e893e834cd8c..7b7918fd18bc9 100644 --- a/pipelined/bevy_pbr2/src/render/light.rs +++ b/pipelined/bevy_pbr2/src/render/light.rs @@ -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