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

Support editing scenes of any large physical size #100896

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Flarkk
Copy link
Contributor

@Flarkk Flarkk commented Dec 29, 2024

Follow-up of #99986.
Note : This PR is ready for review, but kept in Draft state on purpose until dependencies get resolved.

Outline

This PR enables rendering and editing arbitrary large scenes and objects in the Editor.

This is especially useful for open worlds, space scenes and alike.

This is achieved by raising the maximum allowed far (and near) distance in the editor's View settings, and fixing a handful of numerical precision issues :

  • Move computations happening in world space to view space :
    • Gizmo positionning
    • Gizmo handles picking
    • Objects picking
  • Box select of very far away objects
  • Orthogonal camera positionning with very large zfar

Dependencies

Demo

large_zfar_editor.zip

Vegetation is ~1m tall and ~10m from the origin
The terrain is 10 km large
The earth's radius is 6,000 km
The moon's radius is 1,700 km and is 400,000 km from the origin
The sun's radius is 700,000 km and is 150 million km from the origin
The Andromeda galaxy is 152,000 light-years wide and is 2.5 million light years from the observer

output.webm

@Flarkk Flarkk requested review from a team as code owners December 29, 2024 11:24
@Flarkk Flarkk marked this pull request as draft December 29, 2024 11:24
@Flarkk Flarkk changed the title Enable uncapped zfar in Editor Enable unlimited zfar in Editor Dec 29, 2024
@Flarkk Flarkk changed the title Enable unlimited zfar in Editor Support editing scenes of any large physical size Dec 29, 2024
@Chaosus Chaosus added this to the 4.x milestone Dec 29, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected. I can't see the Andromeda galaxy in the MRP though, even with the Z far distance set to 2**63 - 1 (I can see it if I press F to move to its location). I can see the moon at least. Is this due to the PR being outdated?

Needs a rebase.

image

Also, the View editor should clamp the FOV value to 1 degree at least:

image

There could also be a "Infinite"1 checkbox besides the Z far option that makes the option as high as possible (2**63 - 1). When checked, the Z far slider is disabled.

Footnotes

  1. While technically not infinite, it might as well be for all practical purposes and intents. We could also call it "Maximum" if we want to be more accurate, but maybe it's less obvious in terms of what it does.

@Flarkk
Copy link
Contributor Author

Flarkk commented Mar 16, 2025

I can't see the Andromeda galaxy in the MRP though, even with the Z far distance set to 2**63 - 1

The Andromeda galaxy is much much farther than that. Try pushing the far distance to 2**80 at least.

There could also be a "Infinite"1 checkbox besides the Z far option that makes the option as high as possible (2**63 - 1)

The actual maximum float 32 value is (2 - 2**-23) * 2**127) ~= 3.4e+38

the View editor should clamp the FOV value to 1 degree at least

It's currently clamped at 0.01 degree but the step is 0.1 so rounding makes it invisible in the editor.

Unless you noticed artifacts I suggest we keep it as is

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

Successfully merging this pull request may close these issues.

3 participants