Skip to content

Commit f279b7f

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 edad907 commit f279b7f

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
@@ -432,8 +432,8 @@ pub fn check_light_visibility(
432432
// If we have an aabb and transform, do frustum culling
433433
if let (Some(aabb), Some(transform)) = (maybe_aabb, maybe_transform) {
434434
let model_to_world = transform.compute_matrix();
435-
// Do a cheap sphere vs obb test to prune out most meshes
436-
if light_sphere.intersects_obb(aabb, &model_to_world) {
435+
// Do a cheap sphere vs obb test to prune out most meshes outside the sphere of the light
436+
if !light_sphere.intersects_obb(aabb, &model_to_world) {
437437
continue;
438438
}
439439
for (frustum, visible_entities) in cubemap_frusta

0 commit comments

Comments
 (0)