소스 검색

Merge pull request #98562 from Rudolph-B/Issue-98561

Fix Occlusion Culling not working for an orthogonal camera.
Thaddeus Crews 10 달 전
부모
커밋
64b68192cc
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      modules/raycast/raycast_occlusion_cull.cpp
  2. 1 1
      servers/rendering/renderer_scene_occlusion_cull.h

+ 1 - 1
modules/raycast/raycast_occlusion_cull.cpp

@@ -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;

+ 1 - 1
servers/rendering/renderer_scene_occlusion_cull.h

@@ -84,7 +84,7 @@ public:
 				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);