Open
Conversation
Contributor
|
And just multiply |
Contributor
Author
@gchoqueux I agree that simpler computation is better. We are also using camera position for the dot product, simply multiplying the vhMagnitudeSquared (or We need to synchronize the far plane with the horizon culling distance. To make this simpler and remove this ugly square root, my intuition tells me that there is maybe something possible by scaling-up |
Contributor
|
Sorry, I meant: apply a factor to |
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
I am trying to asses issues pointed out by @gchoqueux about horizon clipping with the dynamic near / far option enabled.
For now, this work only targets GlobeView and GlobeLayer, because the way it is computed does not make sense in planarView.
It would be nice to have a uniform 'dynamic far' api for both of them in the end. That's why this PR is marked as draft.
Fixes #2619
New far computation
I implemented a new far computation method that applies a varying factor to horizon distance instead of aplying a linear coefficient to camera sea level altitude. This looks more natural near the ground.
It has 3 parameters :
This method is not mathematicaly perfect, as it is scaling horizon distance in spherical unit earth referencial, then re-multiplying it by max globe radius. It won't exactly match culled horizon distance. But this seemed sufficient to me, horizon culling being quite conservative.
I added some sliders to default example gui to play with those parameters: please pull this branch and try by yourself :)
Culling tiles at the reduced horizon distance
The dynamic far distance was not related to horizon culling in Globe layer. This meant that textures would still be downloaded while the related tile was not rendered. I implemented this horizon scaling behavior by scaling-down the camera position to get expected horizon distance. I could not just cull tiles based on a cutoff distance because horizon culling is actually applied to a single pre-computed point depending on tile curvature and elevation. It behaves like a "mountain" that should not be culled when crossing horizon.
I used cesium reference to find how to compute the target camera squared length that would scale-down the horizon by a provided factor : https://cesium.com/blog/2013/04/25/horizon-culling/
Setting far at a fixed distance in two conditions
I am setting far distance as the furthest point on the globe (on the other side) in two situations :