-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ENH: Removes elevation max zoom from exaggeration calculation for raster-dem sources #9789
Conversation
This includes an update to |
This overall sounds good to me, source max zoom should not influence styling in any way. @brendan-ward could you please add some render tests to cover this? Happy to answer any questions if you have trouble writing them! |
@arindam1993 There are a few existing render tests, though I'd be happy to add more to exercise this specifically.
I'm not able to successfully run these following the instructions (I have an environment setup on MacOS according to the contributor docs):
fails like this:
(note: this is for the existing test, which should work) I'm a bit stumped as I followed the examples in the integration test docs. Can you please point me in the right direction? I didn't see this covered elsewhere in the docs. |
That seems to be coming from |
I was running |
I added a couple integration tests to exercise this functionality, so this should be ready for review. What I didn't see was a way to document the intent of an integration test: i.e., that setting a lower max zoom should produce the same image at zooms below that level. Otherwise, it is just assumed that whatever expected image is checked in is self-evidently right (beyond the person that added the test). Is there a place to add this info? I'm thinking just a one-liner. |
I think that's a very good point, I've found myself in front of failing render tests without knowing exactly the why of the expectation other than the hint given by the test name itself. If that's what you mean? |
I checked what you could be using for that and there's the |
Thanks @karimnaaji - I added those here. This might be a good thing to note on the integration test README |
// We want to vertically exaggerate the hillshading because otherwise | ||
// it is barely noticeable at low zooms. To do this, we multiply this by | ||
// a scale factor that is a function of zooms below 15, which is an arbitrary | ||
// that corresponds to the max zoom level of Mapbox terrain-RGB tiles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terrarium also matches this and goes up to 15 for max zoom.
Looks good, thanks for the PR! |
Yep! I'm glad you asked because I wasn't aware of such a tag. I'll document it, it could be one of the reasons it's underused. |
CP'ed the tests onto master to check how the output changes, the restoration of detail looks good to me. Thanks for the PR @brendan-ward , merging! |
also, cc @mapbox/gl-native shader changes incoming. |
This resolves #9159 by replacing the max zoom of a
raster-dem
tileset used in the hillshade exaggeration calculations with a constant.Originally, the calculation in
hillshade_prepare.fragment.glsl
applied an exaggeration factor (0.3 - 0.4 depending on zoom) to the result of:u_zoom - u_maxzoom
.Instead of
maxzoom
on theraster-dem
tileset only controlling the zooms for which tiles are available, this also caused hillshade layers to render differently for the same source tiles depending on howmaxzoom
was set. For tilesets with fewer available zoom levels, this also meant that tiles could not be overzoomed, and for tilesets with greater available zoom levels, it meant that tiles were not sufficiently exaggerated at low zooms.The tilesets used for implementing the original functionality have a max zoom of 15, and it looks like the original exaggeration calculations were based on what seemed visually pleasing across that range.
Originally, zooming in beyond 15 continued to vary exaggeration based on zoom level. The changes here remove exaggeration beyond zoom 15, as the original solution was really meant to address exaggeration at lower zoom levels instead. As such, this will introduce slight changes in the rendering of hillshade layers beyond zoom 15, if they are kept visible. For the existing visible tiles, hillshade layers don't perform well beyond zoom 15 anyway, so hopefully this has a negligible impact on those uses.
I do not have access to elevation tiles beyond 15, so I was unable to test how tilesets that have more zoom levels available perform under this change.
<changelog>Resolves #9159: decouples hillshade exaggeration from raster-dem maxzoom</changelog>
@mapbox/gl-native: it looks like the native implementation references maxzoom but hardcoded to zoom 15:
But I couldn't find that max zoom was used in the actual hillshade calculation.
/cc @JeffreyEarly