Skip to content

Commit db0f368

Browse files
committed
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.
1 parent feda67a commit db0f368

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pipelined/bevy_pbr2/src/render/light.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ pub fn check_light_visibility(
388388
// If we have an aabb and transform, do frustum culling
389389
if let (Some(aabb), Some(transform)) = (maybe_aabb, maybe_transform) {
390390
let model_to_world = transform.compute_matrix();
391-
// Do a cheap sphere vs obb test to prune out most meshes
392-
if light_sphere.intersects_obb(aabb, &model_to_world) {
391+
// Do a cheap sphere vs obb test to prune out most meshes outside the sphere of the light
392+
if !light_sphere.intersects_obb(aabb, &model_to_world) {
393393
continue;
394394
}
395395
for (frustum, visible_entities) in cubemap_frusta

0 commit comments

Comments
 (0)