mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.06k stars 2.21k forks source link

How to disable lighting effects for wms raster layer? #12869

Open bman654 opened 1 year ago

bman654 commented 1 year ago

Hello,

I'm experimenting with the new standard layer beta and I really like it. Except I've added a raster layer to my map and it is being affected by the lighting effect.

In all of these images, my raster layer is generating YELLOW dots (FFFF00), however using the new standard style they show up on the map in colors ranging from ALMOST WHITE to ALMOST BLACK.

How can I make them show up the unaltered YELLOW from the raw raster image no matter the lighting conditions?

My use case: I want to use the lighting conditions to control the theme of the basemap (e.g. easily switch from light/dark), but I want to control the colors of the data I add to the map. Does not seem possible with the dusk or night presets. Is there something I can override for my raster layer?

lightPreset day

image

lightPreset dusk

image

lightPreset night

image

lightPreset dawn

image

using dark-v11 style

image

Raw Raster Tile

image

mejiafabiandj commented 1 year ago

I also ran into this issue. It seems that all features added to the map are affected by the lighting conditions, with little room for customization. However, I discovered the line-emissive-strength property (I'm working with vector data). Setting this property to 1 prevents my features from being affected by lighting conditions.

I realize you're working with raster data, but I hope my experience can provide a clue to solving your problem.

map.addLayer({
        id: routeLayerId,
        type: 'line',
        source: {
            type: 'geojson',
            data: routeGeoJSON
        },
        paint: {
            'line-color': lineColor,
            'line-width': 8,
            "line-emissive-strength": 1
        }
    });

before (on lightPreset = 'night')

image

after (setting "line-emissive-strength": 1)

image

bman654 commented 1 year ago

Unfortunately it does not look like an emmissive property was added for raster layers. I messed with these paint properties but did not have any success:

          'raster-brightness-min': 0.9,
          "raster-saturation": 1,
          "raster-contrast": 1,
alexwohlbruck commented 1 year ago

From the migration guide, there were a number of new style properties mentioned. Without documentation, it's hard to tell what they all do with the new lighting API, but setting these paint properties with a value of 1 seems to fix the darkened layers when using the night or dusk light modes:

justin-noggle-torch commented 1 month ago

If anyone is still struggling with this, there has been added a raster-emissive-strength property that can solve this. See https://docs.mapbox.com/style-spec/reference/layers/#paint-raster-raster-emissive-strength