-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
Remove elevationOffset and fix below sea-level clipping #1578
Conversation
Bundle size report: Size Change: +132 B
ℹ️ View DetailsNo major changes |
Coverage report
Show files with reduced coverage 🔻
Test suite run success1605 tests passing in 127 suites. Report generated by 🧪jest coverage report action from b0831e4 |
@birkskyum any updates on this? Is there a way for me to help push this forward? |
I don't have an update on it. I did try to adjust the far plane but always ended up with some side effects when the camera is pitched that I couldn't account for. I'm not actively working on it now. |
How did you test it? did you use a debug page of some sort? |
I used the terrain-satellite debug page and zoomed to the dead sea |
For me the following reproduces the error when using I have a feeling this following line is the start of the problem: maplibre-gl-js/src/geo/transform.ts Line 847 in cfbc39f
If I add to the elevation 450 in order to avoid negative values these artifact seems to disappear, I'm jut not 100% sure I know how this camera to sea level is used... |
I think I found a solution, I have no clue if it's a valid one. |
Awesome! I'll try it out now |
@HarelM , I think it's a good solution. I've applied the change here. Some tests fail, but overall it seems like it resolves the clipping issue without changing the elevation level. |
I found a prettier solution I think. I'll commit it to this branch. |
There's still some issue, for example the following scene: |
OK, now it works as expected. :-) BTW, do we want to keep the ability to have an offset for exotic use cases but default it to 0? |
This solution is a lot cleaner. Because no one asked for elevationOffset in the first place, I think we should nix it. |
@prozessor13 any chance for a quick review? |
The only exotic use case I have for elevationOffset is actually for a render-test below sea level. We don't have hillshade data for any area below sea level, so I thought about lowering the demotiles' hill shade data. |
Sure, but I am on vacation, will do it at the end of this week. Regards. |
@prozessor13 Thanks! Enjoy your vacation! |
Hi, i think this calculation in transform.ts is not in all cases correct. See: I think your code works when center is in the dead sea, but not when the dead sea is beside center. I created a sketch for this. I think the red part is still missing. To calculate the red part you must either know the minimum elevation in the current scene, or use a constant for this, e.g. 450m. |
Ah, interesting :-) I'll think about it some more... |
@birkskyum @prozessor13 while I don't think this fix fully solves the issue, I think it's better than now where we have the elevation offset. |
Also worth taking into account that if someone would like to do a map which has elevation data for the bottom of the ocean, the hardcoded 450 won't hold. So we need to make sure the code doesn't have a hard coded value of "bottom of the dead sea" as there are DEM data that are mapping the oceans which might have a lower than -450 elevation... |
A agree that this is quite important to keep working on, especially with the ocean DEM you mention, but I also see this as a step in the right direction. |
@birkskyum can you open a changelog change PR to add this breaking change? I forgot to add it... |
I've opened an issue here: #1655 |
* Remove elevationOffset and add far plane min value of 4000 instead * remove elevationOffset * fix unit tests * Fix clipping of areas below sea level * Remove hardcoded numbers and make sure everything is working as expected. * Fix lint * Improve code readability even more. * test zoomcalculation for elevation below sea level Co-authored-by: HarelM <harel.mazor@gmail.com>
The first two commits just remove the elevation offset.
We have a ~450 elevation offset to move lakes below sea level to places above sea level. It's a workaroud, and it should be removed.