Merge pull request #77294 from puchik/lod-resolution-scaling

Take 3D resolution scaling into account for mesh LOD
This commit is contained in:
Rémi Verschelde 2023-05-24 08:48:38 +02:00
commit ba557aaf55
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -964,7 +964,12 @@ void RendererSceneRenderRD::render_scene(const Ref<RenderSceneBuffers> &p_render
scene_data.z_far = p_camera_data->main_projection.get_z_far();
// this should be the same for all cameras..
scene_data.lod_distance_multiplier = p_camera_data->main_projection.get_lod_multiplier();
const float lod_distance_multiplier = p_camera_data->main_projection.get_lod_multiplier();
// Also, take into account resolution scaling for the multiplier, since we have more leeway with quality
// degradation visibility. Conversely, allow upwards scaling, too, for increased mesh detail at high res.
const float scaling_3d_scale = GLOBAL_GET("rendering/scaling_3d/scale");
scene_data.lod_distance_multiplier = lod_distance_multiplier * (1.0 / scaling_3d_scale);
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
scene_data.screen_mesh_lod_threshold = 0.0;