Merge pull request #91789 from lawnjelly/fix_tight_light_cull_directional_colinear

[3.x] Tighter light culling - fix directional lights colinear case
This commit is contained in:
lawnjelly 2024-05-10 10:51:14 +01:00 committed by GitHub
commit 30b025d3d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -227,10 +227,12 @@ bool VisualServerLightCuller::add_light_camera_planes_directional(const LightSou
// Create a third point from the light direction. // Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir; Vector3 pt2 = pt0 - p_light_source.dir;
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points. // Create plane from 3 points.
Plane p(pt0, pt1, pt2); Plane p(pt0, pt1, pt2);
add_cull_plane(p); add_cull_plane(p);
} }
}
// Last to 0 edge. // Last to 0 edge.
if (n_edges) { if (n_edges) {
@ -243,10 +245,12 @@ bool VisualServerLightCuller::add_light_camera_planes_directional(const LightSou
// Create a third point from the light direction. // Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir; Vector3 pt2 = pt0 - p_light_source.dir;
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points. // Create plane from 3 points.
Plane p(pt0, pt1, pt2); Plane p(pt0, pt1, pt2);
add_cull_plane(p); add_cull_plane(p);
} }
}
#ifdef LIGHT_CULLER_DEBUG_LOGGING #ifdef LIGHT_CULLER_DEBUG_LOGGING
if (is_logging()) { if (is_logging()) {