Skip to content

Commit

Permalink
Fix Occlusion Culling not working for an orthogonal camera.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudolph-B committed Oct 26, 2024
1 parent 61accf0 commit 76c2038
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/raycast/raycast_occlusion_cull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::_generate_camera_rays(const CameraRa

Vector3 dir;
if (p_data->camera_orthogonal) {
dir = -p_data->camera_dir;
dir = p_data->camera_dir;
tile.ray.org_x[j] = pixel_pos.x - dir.x * p_data->z_near;
tile.ray.org_y[j] = pixel_pos.y - dir.y * p_data->z_near;
tile.ray.org_z[j] = pixel_pos.z - dir.z * p_data->z_near;
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_scene_occlusion_cull.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class RendererSceneOcclusionCull {
Vector3 view = p_cam_inv_transform.xform(corner);

if (p_cam_projection.is_orthogonal()) {
min_depth = MIN(min_depth, view.z);
min_depth = MIN(min_depth, -view.z);
}

Plane vp = Plane(view, 1.0);
Expand Down

0 comments on commit 76c2038

Please sign in to comment.