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

Fixed bug when switching to orthographic camera on first frame #8853

Merged
merged 5 commits into from
Jun 28, 2020

Conversation

IanLilleyT
Copy link
Contributor

@IanLilleyT IanLilleyT commented May 14, 2020

Don't merge until #8850 is ready.

When going from perspective to orthographic, it does a depth pick to figure out what size to make the frustum. The closer you are to an object, the smaller the orthographic frustum.

This was failing on the first frame because it was reading a garbage depth value, since nothing had been renderer yet. This PR adds a check for this and uses the cartographic height as a fallback.

There's another fix in here which makes sure to reconstruct the world space position using the correct frustum. The old code was reconstructing the perspective-generated depth with the new orthographic frustum, resulting in an incorrect world position. Now it reconstructs with the perspective frustum before changing to orthographic.

Before:

Screen Shot 2020-05-14 at 2 42 36 PM

After:

Screen Shot 2020-05-14 at 2 42 15 PM

@IanLilleyT IanLilleyT requested a review from lilleyse May 14, 2020 20:34
@cesium-concierge
Copy link

Thanks for the pull request @IanLilleyT!

  • ✔️ Signed CLA found.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

Base automatically changed from orthoCameraFixBounds to master June 28, 2020 02:32
@lilleyse
Copy link
Contributor

Confirmed that this fixes the problem of the orthographic frustum not being sized correctly on the first frame.

Local sandcastle vs. hosted sandcastle

@lilleyse lilleyse merged commit 617e5ed into master Jun 28, 2020
@lilleyse lilleyse deleted the orthoCameraFixInitial branch June 28, 2020 13:41
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.

3 participants