Add possibility to setup Camera above horizon for augmented reality support#846
Open
EMaksymenko wants to merge 6 commits intoNASAWorldWind:developfrom
Open
Add possibility to setup Camera above horizon for augmented reality support#846EMaksymenko wants to merge 6 commits intoNASAWorldWind:developfrom
EMaksymenko wants to merge 6 commits intoNASAWorldWind:developfrom
Conversation
* Added the KeyboardControls module to utils. * Added the creation of a KeyboardControls object to the WorldWindow.
Migrate applications to use Camera instead of Navigator. Remove Projection.geographicToLocalTransform. Rename LookAt.lookAtPosition to LookAt.position. Move Camera and LookAt to geom package. Do not convert Camera to LookAt for compass. Use Camera heading and tilt directly. Use picked terrain position instead of forward ray globe intersection. Implement camera field of view processing. Check camera altitude to avoid falling under the surface. Migrate KeyboardControls from Navigator to Camera. Migrate tests to use Camera instead of Navigator.
PJHogan
previously approved these changes
Aug 5, 2022
ace69b7 to
88f80fe
Compare
2ea276a to
cda680d
Compare
…en Camera and LookAt to WorldWindow.
cda680d to
20c5526
Compare
729bdb4 to
8c4c836
Compare
7e751ca to
1fcbab5
Compare
1fcbab5 to
ef2f7df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Changes
LookAtNavigator concept was replaced by Camera and LookAt objects.
This approach allows to set camera position and rotation freely without having obligatory viewport center on the terrain.
LookAt object is a virtual look at position which can be used to set camera orientation from the perspective of looking at some point from some range and rotation. It is used to provide similar behaviour to WorldWindowController as LookAtNavigator before.
Also this improvement adds camera field of view assignment for advanced camera control and future augmented reality capabilities.
As a side effect - near clip distance calculation and camera limits was added, which prevent putting camera under the terrain.
Why Should This Be In Core?
This feature is present in Java and Android SDK, but missing in JS.
It is not possible to control camera tilt above horizon and camera field of view, which are required to display e.g. augmented reality view or represent real flexible camera behavior in 3D space.
Benefits
This enhancement allows to control camera based on it own position, heading, tilt, roll and field of view.
Look at position is only a virtual point on terrain which can be used to setup camera attributes during navigation.
This improvement also fix camera falling under the terrain. Now near clip distance is calculated correctly and camera navigation has limits to be above the ground.
Potential Drawbacks
Performance of picking lookAt position on every gesture begin is quite low. It should be used correctly to avoid infinite rendering loop.
New approach of view matrix calculation based on field of view gives little bit different test results than original approach, when calculating pixel size at distance and perspective projection.
This PR is a huge refactoring of viewing concept and must be tested a lot before merge.
Some tests where commented, because they require normal GLCanvas instead of mock due to a pick operation inside.