Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a project setting to control visibility range scale factor #3787

Open
Calinou opened this issue Jan 11, 2022 · 2 comments
Open

Add a project setting to control visibility range scale factor #3787

Calinou opened this issue Jan 11, 2022 · 2 comments

Comments

@Calinou
Copy link
Member

Calinou commented Jan 11, 2022

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Visibility ranges make it easy to set up manual (H)LOD, but they lack a global way to scale the distances down for low-end machines (or conversely, for high-end setups).

This can also be problematic in games where FOV changes are frequent (e.g. when using binoculars), since visibility ranges should be increased in this case.

A global setting will allow for quick level of detail adjustments in situations where automatic mesh LOD is not enough on its own.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a property that acts as a multiplier for all visibility range calculation. The distance between the camera and object is multiplied by this value, which means that higher values will use lower level of detail more quickly. Conversely, setting this multiplier to 0.0 will skip (H)LOD calculations entirely and will always use the highest level of detail. This can be used for quick performance comparisons between manual (H)LOD being enabled and disabled.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Ideally, there should be a visibility_range_scale property in Viewport to complement mesh_lod_threshold. Like rendering/mesh_lod/lod_change/threshold_pixels, there should be a project setting to control this property on the root Viewport (maybe rendering/visibility_range/visibility_range_distance_scale).

If a per-viewport visibility range scale is not technically feasible, then a global property should be added somewhere (perhaps World3D?) to control the visibility range scale.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This can be worked around by increasing visibility range distances on every mesh at run-time. It can be done using groups or something similar, but it's not particularly easy or convenient to do in a reliable manner. This also can't be customized on a per-viewport basis, which may be desired for split-screen games or games that use a secondary viewport to draw a real-time minimap.

Is there a reason why this should be core and not an add-on in the asset library?

See above.

@mrjustaguy
Copy link

Maybe we could figure out a way to make an estimation of how large in pixels the object is based on it's AABB and Distance to Camera and the Camera's FOV, and make the VR use the largest Size in Pixels instead of distance.

@Calinou
Copy link
Member Author

Calinou commented Jan 12, 2022

Maybe we could figure out a way to make an estimation of how large in pixels the object is based on it's AABB and Distance to Camera and the Camera's FOV, and make the VR use the largest Size in Pixels instead of distance.

See my comment in the pull request: godotengine/godot#48847 (comment)

The current visibility range system uses absolute units by design. Changing it to use a pixel density system would likely make it harder to control from a developer perspective, on top of requiring more expensive calculations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants