Take 3D resolution scaling into account for mesh LOD

(cherry picked from commit ac4ca89000)
This commit is contained in:
Arman Elgudzhyan 2023-06-29 16:03:22 +02:00 committed by Yuri Sizov
parent 88475cfba9
commit 05eeb8783c

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;