-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Elevation Band Material #9132
Elevation Band Material #9132
Conversation
Thanks for the pull request @IanLilleyT!
Reviewers, don't forget to make sure that:
|
Looks amazing! Is there a reason someone would choose to use the old elevation material over this? |
|
It's possible this new material can deprecate |
👍 for deprecating and then removing other classes if we can replace them with different usages for this. If the setup is non-obvious, we can use helper functions or derived classes so that the API is easy but the overall implementation is less code. The less code overall, the better. |
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
1 similar comment
Thanks again for your contribution @IanLilleyT! No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy? I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with |
Merge #9287 first
This material is very similar to the
ElevationRamp
material (https://sandcastle.cesium.com/?src=Globe%20Materials.html) but provides a lot more flexibility and accuracy. The main limitation withElevationRamp
is the quality is tied to the texture resolution, so it's not possible to map colors or gradients to exact elevations without extremely large textures.ElevationBand
works a bit differently. It feeds a texture of heights and a texture of colors at those heights to the shader, which does a binary search from an input height to find out which two colors to interpolate between. This means unique colors and gradients can be mapped to many different elevation ranges with minimal texture memory and still be quite performant.While the
ElevationBand
height and color textures can be created from scratch, it's much easier to go through thecreateElevationBandMaterial.js
helper file which takes an array of layers, each containing an array of height / color pairs, and flattens them on top of each other, returning a singleMaterial
. This way you can implement more complex behaviors like background gradients, movable bands, etc.Here's the feature in action. Everything in the gif, including the narrow white grid lines on the mountain, is ultimately a single material. It gets recreated whenever the UI changes.
Sandcastle demo on local host
Also, a Sandcastle demo on local host for showing the difference between creating a simple gradient with
ElevationRamp
andElevationBand
. The results should look identical.