itowns
itowns copied to clipboard
Feature RGBA-encoded elevation
itowns is supposed to support RGBA-encoded elevation with ElevationLayer
.
There is a option ELEVATION_MODES.RGBA
but it's not possible to active this mode.
In shader, there is a method decode32
to decode rgba
to float
.
- [ ] add
ElevationLayer
option to activeELEVATION_MODES.RGBA
; - [ ] add example with
ELEVATION_MODES.RGBA
mode (you also need a server that provides such data); - [ ] replace
decode32
byunpackRGBAToDepth
fromThree.js
;
@AnthonyGlt can you fill this issue with your tests and first results and maybe share produced datasets?
For my tests, I've used TMSSource. I've removed from GlobeView.js the error threw when the elevation layer crs isn't in EPSG:4326 (for mapbox, it's in EPSG:3857).
I've had to set the option useRgbaTextureElevation
of my elevation layer. I removed the triggered error in RasterTile.js.
Then I had to decode the RGB value to get the elevation.
To do that I've modified elevation_pars_vertex.glsl
and implemented this formula https://blog.mapbox.com/global-elevation-data-6689f1d0ba65
I was able to load the elevation, however there is an issue with the camera culling. The tiles closest to the camera are not loaded. This seems to come from the missing zmin in the bounding box (Obb.js
).
You can check my forked branch : https://github.com/AnthonyGlt/itowns/tree/terrain
Note: My html example is messy (still testing).
To generate the elevation data, I've used gdal to convert IGN data to a .tif, then, using rio-rgbify, I was able to obtain rgb encoded data. We can then convert the data to mbtiles using rio-rgbify or mb-util.