Skip to content

Commit

Permalink
Merge pull request #91790 from lawnjelly/fix_tight_light_cull_directi…
Browse files Browse the repository at this point in the history
…onal_colinear4

Tighter light culling - fix directional lights colinear case
  • Loading branch information
akien-mga committed May 10, 2024
2 parents 7724a50 + a76243a commit 2ba22d1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions servers/rendering/rendering_light_culler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ bool RenderingLightCuller::add_light_camera_planes_directional(LightCullPlanes &
// Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir;

// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
}
}

// Last to 0 edge.
Expand All @@ -295,9 +297,11 @@ bool RenderingLightCuller::add_light_camera_planes_directional(LightCullPlanes &
// Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir;

// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
}
}

#ifdef LIGHT_CULLER_DEBUG_LOGGING
Expand Down

0 comments on commit 2ba22d1

Please sign in to comment.