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

Camera clipping terrain fix #3750

Closed
wants to merge 1 commit into from
Closed

Camera clipping terrain fix #3750

wants to merge 1 commit into from

Conversation

lilleyse
Copy link
Contributor

Fixes #3178.

Also fixes the atmosphere flickering that happens when the camera is swiveled into the ground.

This fix doesn't really solve the underlying problem. ScreenSpaceCameraController.adjustHeightForTerrain generates non-orthonormal view vectors which causes inverseTransformation to not work as expected. I'm not completely sure how to fix that, but this is a quick fix that works at a slight computation cost.


// Camera vectors may not be orthonormal when the camera clamps to the terrain
// so apply inverse instead of inverseTransformation
Matrix4.inverse(camera._viewMatrix, camera._invViewMatrix);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this just a band-aid? Should we apply Gram–Schmidt orthonormalization earlier so the matrix is orthonormal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes just a band-aid right now. I'll try to fix the main problem before this is ready.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine the shadows branch, but are you sure you want to put this in master now?

Copy link
Contributor

Choose a reason for hiding this comment

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

@lilleyse what do you think? Should we close this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll close this and submit an issue instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or.. just keep the fog issue open.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's leave the fog issue open.

This was referenced Mar 31, 2016
@pjcozzi pjcozzi closed this Apr 4, 2016
@lilleyse lilleyse deleted the inv-view-matrix-fix branch April 4, 2016 18:30
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.

Fog dark
2 participants