mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 11:32:13 +00:00
Merge pull request #98257 from Rudolph-B/94210-B
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
🔗 GHA / 🪲 Godot CPP (push) Blocked by required conditions
Fix to occlusion culling where all math is based on Euclidean distance.
This commit is contained in:
commit
78a4e634f0
@ -181,17 +181,7 @@ void RaycastOcclusionCull::RaycastHZBuffer::sort_rays(const Vector3 &p_camera_di
|
||||
}
|
||||
int k = tile_i * TILE_SIZE + tile_j;
|
||||
int tile_index = i * tile_grid_size.x + j;
|
||||
float d = camera_rays[tile_index].ray.tfar[k];
|
||||
|
||||
if (!p_orthogonal) {
|
||||
const float &dir_x = camera_rays[tile_index].ray.dir_x[k];
|
||||
const float &dir_y = camera_rays[tile_index].ray.dir_y[k];
|
||||
const float &dir_z = camera_rays[tile_index].ray.dir_z[k];
|
||||
float cos_theta = p_camera_dir.x * dir_x + p_camera_dir.y * dir_y + p_camera_dir.z * dir_z;
|
||||
d *= cos_theta;
|
||||
}
|
||||
|
||||
mips[0][y * buffer_size.x + x] = d;
|
||||
mips[0][y * buffer_size.x + x] = camera_rays[tile_index].ray.tfar[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
float min_depth = -closest_point_view.z * 0.95f;
|
||||
float min_depth = (closest_point - p_cam_position).length();
|
||||
|
||||
Vector2 rect_min = Vector2(FLT_MAX, FLT_MAX);
|
||||
Vector2 rect_max = Vector2(FLT_MIN, FLT_MIN);
|
||||
@ -83,6 +83,10 @@ public:
|
||||
Vector3 corner = Vector3(p_bounds[0] * c.x + p_bounds[3] * nc.x, p_bounds[1] * c.y + p_bounds[4] * nc.y, p_bounds[2] * c.z + p_bounds[5] * nc.z);
|
||||
Vector3 view = p_cam_inv_transform.xform(corner);
|
||||
|
||||
if (p_cam_projection.is_orthogonal()) {
|
||||
min_depth = MIN(min_depth, view.z);
|
||||
}
|
||||
|
||||
Plane vp = Plane(view, 1.0);
|
||||
Plane projected = p_cam_projection.xform4(vp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user