-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[3d] Large scene support: shift scene's origin if the camera got too far #60869
Conversation
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So nice!
All the underlying work finally getting enabled!
This should greatly improve our capability to handle large scenes (e.g. more than 50km across) Also add a checkbox to the debug panel to allow devs temporarily turn it off.
cb82929
to
e447b59
Compare
for more information, see https://pre-commit.ci
Relax the assumption that origin is always in the center of the scene
Origin may get updated in Qgs3DMapScene constructor, so let's set ours once the Qgs3DMapScene is constructed
Looks fantastic -- great work @wonder-sk !! |
This "origin rebasing" or "origin shifting" technique is commonly used in various 3D engines when dealing with large scenes (where objects need double precision coordinates). It should greatly improve our capability to handle large scenes (e.g. more than 50km across)
For now, I have used a simple rule that when camera gets 10 km away from the world's origin, the origin is shifted (and camera is placed at the origin). The origin shift has a bit of a cost (we're updating 4x4 transform matrices of all active nodes), so we prefer not to do it on every camera change, but only when necessary. That said, I have not seen slowdowns when origin gets shifted.
Also add a checkbox to the debug panel to allow devs temporarily turn it off.
A related philosophical question from Futurama:
Before:
simplescreenrecorder-2025-03-05_15.31.36.mp4
After:
simplescreenrecorder-2025-03-05_15.34.44.mp4