Fast hight-resolution slope and aspect information on a per image-tile basis

1. A concise explanation of the problem you're experiencing.

My image provider is too slow, because it requires a ground-height ray-cast per pixel or per group of pixels.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

My crappy code can be found at the following link...

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I'm trying to color the terrain based upon slope and aspect. Now, a better way would be to pre-calculate all of this information and then have it served to the client on-demand. Is there not already an image provide out there somewhere that serves images that just provide height information, or normals or slopes or aspects? Because, if so, my image provider could just piggy-back on that other image provider.

Note: I'm not talking about image providers that provide images that you can render. I'm talking about providing images that just contain data like height values or normal vectors, etc. I've searched around quite a bit, but I can't find any useful image providers that provide this kind of information. Do they not exist?

4. The Cesium version you're using, your operating system and browser.

I'm using 1.51 of Cesium on Windows 10 in Chrome.

I’m not aware of imagery providers that give you this information baked into the images. I think the terrain provider might come with this information though, since I know you can request vertex normals in the tiles like in this example:

This one renders the slope and elevation. You might need to write a custom shader to compute exactly what you need though. I would look at the SlopeRamp material in the source code for inspiration.

This does seem like a common thing so eventually a tutorial or example on how to access this information might be very valuable. If you make any progress on this it’d be great to share!

This has been very helpful, thank you. I believe this is the way to go.

I've been searching the Cesium git repo looking for details on how the ElevationRamp and the SlopeRamp materials are implemented, but I can't find them anywhere. I can find, for example, PolylineOutlineMaterial.glsl and see how that's coded up. Where on earth is the SlopeRamp.glsl file? I'm going to keep searching in the mean time. It has to be somewhere.

I found the following...

My git skills are failing me. The repo I closed for Cesium has just a master branch whose top commit is 2 years old. Unless Cesium is a dead project, the repo has been moved or something and I've cloned from the wrong origin.

Finally, here it is...

I guess I should try re-cloning the repo.

Sorry for not getting to this sooner, but I’m glad you figured it out! I see you’ve opened a PR here:

It looks awesome! Hope it gets merged soon. Thanks again for making this contribution!