Reviving this thread I've been testing the same in my iOS app which uses the Mapbox SDK. Anyone have success bringing their own DEM sources in Mapbox?
After adding a custom DEM with elevations encoded in RGB according to the Mapbox formula (height = -10000 + ((R * 256 * 256 + G * 256 + B) * 0.1), I do see elevation changes on my map when 3D is toggled on, but they are widely exaggerated spikes (mountains are something like hundreds of KM tall). As a hack, I tried reducing terrain exaggeration by 100x but it nearly flattened them. Iterative values in between resulted in non-useful spikes, so I think I'm barking up the wrong tree.
Any ideas?
if !mapView.mapboxMap.sourceExists(withId: "my-custom-dem") {
var source = RasterDemSource(id: "my-custom-dem")
source.url = "mapbox://username.my-custom-dem"
source.encoding = .mapbox // Tells Mapbox how to decode the RGB values
source.maxzoom = 16.0
source.minzoom = 0.0 // Allow full zoom range from 0-16