davenquinn / cesium-martini

On-the-fly meshing of raster elevation tiles for the CesiumJS virtual globe
MIT License
81 stars 17 forks source link

Generating client-side hillshade using Terrain RGB tiles? #16

Open rumicuna opened 1 year ago

rumicuna commented 1 year ago

@davenquinn In your post: https://community.cesium.com/t/hillshade-using-cesium-terrain/9590/2 you mention that you were able to generate client-side hillshade using Terrain RGB tiles. I'm trying to do the same thing you are, but in my case I'd like to generate both a hillshare and also a high-res slope rendering from the rgb tiles. From your post I gather that you created a custom Cesium ImageryProvider and did not do it in the cesium-martini code. Is that effort something you have open sourced (I can't find it in your repo list) or plan on doing so at some point? If not, I would be so thankful if you could point me in the right direction as to what it took for you to code this? Thank you! -Martin

davenquinn commented 1 year ago

Hi Martin, sure —

The code right now is in another module: https://github.com/UW-Macrostrat/cesium-viewer/blob/master/src/layers/terrain/hillshade.ts. It works pretty well but it is relatively inflexible (e.g., it does not allow variation of the illumination angles and intensity). Slope etc. would be possible with relatively small changes to the approach I think. I'm also not good with WebGL (and probably won't become so anytime soon) so I'm sure I'm missing some ways to optimize and improve the approach.

I'd be happy to parse out this renderer into a separate module if you wanted to collaborate on a library.

rumicuna commented 1 year ago

Awesome, thank you! I'd love to collaborate on a library, I'll start playing with your code, hopefully I can make some improvements to share back with you.