-
-
Notifications
You must be signed in to change notification settings - Fork 932
Hypsometric Tint from terrain-RGB tiles #5742
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
Conversation
|
Thanks for this! |
Right, I see your newer reply to Harel from earlier explaining the additional requirement. Looking at the defined stops for the LINZ and categorical ramps, your decision makes sense. |
The current approach could swap the uniform array for a texture without any conceptual changes. The main reason I chose a uniform array instead of a texture is for code clarity (I use a I do see one advantage to using a texture, which is that the minimum GL_MAX_TEXTURE_SIZE is 64, compared to the minimum GL_MAX_FRAGMENT_UNIFORM_VECTORS, which is 16. I'm not sure how likely we are to see such low values for GL_MAX_FRAGMENT_UNIFORM_VECTORS, all the hardware I have access to has GL_MAX_FRAGMENT_UNIFORM_VECTORS = 1024. So it feels like a trade-off between "code clarity and performance in typical use-cases and environments", vs "correctness on very limited hardware or color ramps with a huge number of colors". |
I agree, and also expect there are devices still in use which run closer to the lower bound of these limits. It may be worthwhile to examine mobile device hardware surveys and inspect the feature sets supported by devices in the longer tail end of active support. WebGL 2, featuring a much more useful limit, offers a decent filter on supported minimums, but I'd be wary of anything that still requires original WebGL. |
|
Marked as draft while I create a version that uses textures for comparison. |
|
I got a version working with textures (#5913). For clarity, you can see the differences here: NathanMOlson#5. Here are the benchmarks for the version using uniforms: The version using uniforms scores 2% faster on a 2-color color ramp, and 13% faster on a 256-color color ramp. I think we should probably use the texture version so we can support WebGL1 on low-end devices. I'll start cleaning that version up to replace this PR unless I hear otherwise. |
|
Superceded by #5913. |
|
I'm a bit lost with all the branches and PRs. |








Resolves #5666 (Hypsometric Tint from terrain-RGB tiles). Supporting style spec changes are here: https://github.com/NathanMOlson/maplibre-style-spec/tree/color_relief
Demo here: https://nathanmolson.github.io/color_relief
The shader uses a binary search to find the adjacent color stops from the color ramp, which means that larger color palettes take longer to render (O(log(n))).
Examples:
CHANGELOG.mdunder the## mainsection.