Commit 77f4ed5
[MAPSPERF-51][GL-JS] Elevated raster layer: raster-elevation-reference support (#9490)
Fixes and improvements to elevated raster layers as requested by TWC.
Addresses: MAPSPERF-50 and MAPSPERF-51
**Context**
TWC reported
([RICO-15889](https://mapbox.atlassian.net/browse/RICO-15889))
inconsistent shading for raster layers when switching between mercator
and globe projections.
Maintaining uniform shading is technically unfeasible for draped or
baked raster layers across mercator/globe projection.
Idea to work around this limitation, is to move layers out of the
draping using raster-elevation to get consistent shading of the layer
even during mercator/globe transitions.
In order to also support terrain (and not intersect with terrain
geometry), this PR introduces `raster-elevation-reference:
{ground,sea}`, enabling the layer to follow the terrain surface
(`ground`) or maintain constant elevation above sea level (`sea` -
default) while applying z-bias to resolve depth-testing conflicts.
**Demo**:
https://labs.tilestream.net/labs-raster-layer/raster-elevation.htm
> [!NOTE]
> Implementation is for GL-JS only, changes in native are result of
shader changes.
> Native implementation will follow in separate PR.
**Changes**
- Add z-bias to fix z-fighting for raster layers independent of
elevation
- Add new **experimental** paint property `raster-elevation-reference`
to apply elevation relative to ground or sea (default) level
- Render test `raster-elevation-tiled/terrain-ground-reference` (gl-js
only, disabled in native)
**How does it look?**
https://github.com/user-attachments/assets/a9463bab-b460-4e6e-991a-289e03b576e0
Style config:
~~~json
{
"id": "image",
"type": "raster",
"source": "twc-raster-elevation",
"slot": "middle",
"paint": {
"raster-fade-duration": 0,
"raster-opacity": 0.5,
"raster-elevation": 0.0001,
"raster-elevation-reference": "ground"
"raster-emissive-strength": 1.0
}
}
~~~
~~~
<public>
Fix z-fighting for elevated raster layers.
Add paint property raster-elevation-reference to elevate raster layers
relative to ground instead of sea level.
</public>
~~~
cc @mapbox/gl-js
cc @mapbox/gl-native
cc @mapbox/maps-ios
cc @mapbox/maps-android
[RICO-15889]:
https://mapbox.atlassian.net/browse/RICO-15889?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
---------
Co-authored-by: Aleksandar Stojiljković <aleksandar.stojiljkovic@mapbox.com>
GitOrigin-RevId: 8c8269d43c23ddc0647b26184123baa0105563591 parent 4aa1873 commit 77f4ed5
1 file changed
+3
-3
lines changedLines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments