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

Fix camera zooming in 3D orthographic mode when pixelRatio is not 1 #12487

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

andrewda
Copy link
Contributor

Description

Zooming in 3D orthographic view is broken at high camera heights when pixel ratio is not 1. See the attached video:

CleanShot.2025-02-19.at.11.52.56.mp4

This PR fixes that behavior by considering the pixel ratio in the orthographic frustum width calculation:

CleanShot.2025-02-19.at.11.53.32.mp4

Issue number and link

#12486

Testing plan

https://sandcastle.cesium.com/#c=bZBBa8MwDIX/ismpheKw65qGbYXtMih0YydfXEdNzGwpSHZCN/bfl7SX0VW3J71PesgRSlKDhxFYbRTCqLYgPkf9ce4tTOHOekuYrEdgU6zUt0GlssAT0yjAe3AUI2ADzR6EQk6e8F4dbRBYGfxZrg0avBzR4gBBt4EOoKWj8YUpY/OYIknfAcOU4gyurwhnI7DVMvrkunfaceqoZdt33j1zlpTjYrkuVkUl6RSgnhPO9eBjT5xU5rDQukwQ+2ATSHnI7hOSdiJzvNlalX/RqvGD8s3mxgOUC1ZkmhxzCG/+C0xRV+Xk/4cGso3HdjcAB3uabd1d/Xppaq2rcpK3yUQUDpavNv8C

const viewer = new Cesium.Viewer("cesiumContainer", {
  useBrowserRecommendedResolution: false,
});

viewer.scene.globe.showGroundAtmosphere = false;
viewer.scene.camera.switchToOrthographicFrustum();

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

Thank you for the pull request, @andrewda!

✅ We can confirm we have a CLA on file for you.

@andrewda andrewda changed the title Fix 3D orthographic mode when pixelRatio is not 1 Fix camera zooming in 3D orthographic mode when pixelRatio is not 1 Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant