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

Add possibility to setup Camera above horizon for augmented reality support #846

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

ComBatVision
Copy link

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.

* 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
PJHogan previously approved these changes Aug 5, 2022
@ComBatVision ComBatVision force-pushed the enhancement/free-camera-support branch 6 times, most recently from ace69b7 to 88f80fe Compare September 15, 2022 18:28
@ComBatVision ComBatVision force-pushed the enhancement/free-camera-support branch 8 times, most recently from 2ea276a to cda680d Compare September 19, 2022 10:18
@ComBatVision ComBatVision force-pushed the enhancement/free-camera-support branch 8 times, most recently from 729bdb4 to 8c4c836 Compare September 28, 2022 23:47
@ComBatVision ComBatVision force-pushed the enhancement/free-camera-support branch 2 times, most recently from 7e751ca to 1fcbab5 Compare September 29, 2022 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants