Skip to content

SceneLoadRearMaxRadiusFraction not stored as a fraction, causing too many rear objects to load #4794

@minerjr

Description

@minerjr

Environment

Second Life Test 7.2.2.252770827 (64bit)
Release Notes

CPU: 12th Gen Intel(R) Core(TM) i7-12700K (3609.6 MHz)
Memory: 32474 MB
OS Version: Microsoft Windows 11 64-bit (Build 26100.6725)
Graphics Card Vendor: ATI Technologies Inc.
Graphics Card: AMD Radeon RX 6600

Windows Graphics Driver Version: 32.0.21025.10016
OpenGL Version: 4.6.0 Core Profile Context 25.9.1.250822

Window size: 1920x1009
Font Size Adjustment: 96pt
UI Scaling: 1
Draw distance: 256m
Bandwidth: 10000kbit/s
LOD factor: 2
Render quality: 6
Texture memory: 8146MB
Disk cache: Max size 3494.4 MB (0.0% used)

J2C Decoder Version: OpenJPEG runtime: 2.5.3
Audio Driver Version: OpenAL, version 1.1 ALSOFT 1.24.2 / OpenAL Community / OpenAL Soft: OpenAL Soft
Dullahan: 1.21.0.202508272159
CEF: 139.0.28+g55ab8a8+chromium-139.0.7258.139
Chromium: 139.0.7258.139
LibVLC Version: 3.0.21
Voice Server Version:

October 06 2025 13:48:25

Description

When you look at the SceneLoadRearMaxRadiusFraction value stored in the settings.xml, you will notice that the value is set to 75.0 for a float value. And the comments mention it is suppose to be fraction.

The code that uses it is for scaling the amount of the scene behind the visible camera is loaded. The issue is because the calculation no longer is divided by 100.0f, the draw distance is multiplied by the value and then clamped at the draw distance value. So it is effectively only ever the draw distance and not the default 75% of it. So a 256 draw distance is locked at 256 meters instead of 192.

This causes more objects to load behind the user, especially very far objects which can cause more RAM and VRAM usage, especially on teleport.

With current 75.0 value:

Image

With new 0.75 value:

Image

The code that was changed is in commit:
8ef25a6

Original code, note the read_max_radius_frac * gAgentCamera.mDrawDistance / 100.0f:

 // a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold
    static LLCachedControl<F32> rear_max_radius_frac(gSavedSettings,"SceneLoadRearMaxRadiusFraction");
    sRearFarRadius = llmax(rear_max_radius_frac * gAgentCamera.mDrawDistance / 100.f, 1.0f); //minimum value is 1.0m
    sRearFarRadius = llmax(sRearFarRadius, (F32)min_radius); //can not be less than "SceneLoadMinRadius".
    sRearFarRadius = llmin(sRearFarRadius, gAgentCamera.mDrawDistance); //can not be more than the draw distance. 

New Code from above commit: Note the rear_max_radius_frac * gAgentCamera.mDrawDistance with no "/ 100.0f"

// a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold
    static LLCachedControl<F32> rear_max_radius_frac(gSavedSettings,"SceneLoadRearMaxRadiusFraction");
    const F32 min_radius_plus_one = sNearRadius + 1.f;
    const F32 max_radius = rear_max_radius_frac * gAgentCamera.mDrawDistance;
    const F32 clamped_max_radius = llclamp(max_radius, min_radius_plus_one, draw_radius); // [sNearRadius, mDrawDistance]
    sRearFarRadius = min_radius_plus_one + ((clamped_max_radius - min_radius_plus_one) * adjust_factor);

Reproduction steps

  1. Optional: Clear cache (it makes it easier to test out).
  2. Load Viewer
  3. Select a region where there are a lot of objects that are behind the user when first loaded.
  4. Turn on the Texture Console under Develop->Consoles->Texture
  5. Take note of the # of Textures, Texture VRAM and System Free RAM after all textures are loaded.
  6. Exit the viewer
  7. Edit the setting.xml and change the value for SceneLoadRearMaxRadiusFraction from 75.0 to 0.75.
  8. Optional: Clear cache again
  9. Load the viewer
  10. Login to the same region and location (Use last location)
  11. Turn on the Texture Console again
  12. Take note of the new # of textures, Texture VRAM and System Free RAM after all textures are loaded.


This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #4794 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @minerjr (replace 20 with the amount, and @minerjr with the user to tip).

📖 If you want to learn more, check out our documentation.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageFlags issues that need to be triaged

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions