Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Tighter light culling - fix directional lights colinear case #91789

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions servers/visual/visual_server_light_culler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ bool VisualServerLightCuller::add_light_camera_planes_directional(const LightSou
// 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);
add_cull_plane(p);
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
add_cull_plane(p);
}
}

// Last to 0 edge.
Expand All @@ -243,9 +245,11 @@ bool VisualServerLightCuller::add_light_camera_planes_directional(const LightSou
// 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);
add_cull_plane(p);
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points.
Plane p(pt0, pt1, pt2);
add_cull_plane(p);
}
}

#ifdef LIGHT_CULLER_DEBUG_LOGGING
Expand Down
Loading