Open Akiyamka opened 4 years ago
I believe mapbox adds a small shift to the depth when rendering each 2D layer. You can try compensate for that by adding a small z to the layer in getPosition
.
@Pessimistress nice theory but in practice it was not confirmed, I add z coordinate in getPosition and recorded video where you can see that the position is completely ignored in the top view https://www.loom.com/share/dc59f47dc7e444ccb17db2fc2a593d4e
First of all I would like to understand this is a problem on the deck gl or mapbox side
Can you try adding this prop to your scatterplot layer:
parameters: {
depthRange: [0, 1]
}
@Pessimistress I add it in right place?
new ScatterplotLayer({
id: 'scatter-plot',
data: ('https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/scatterplot/manhattan.json' as unknown),
radiusScale: 30,
radiusMinPixels: 0.5,
getPosition: (d) => [d[0], d[1], 100],
getFillColor: (d) => (d[2] === 1 ? MALE_COLOR : FEMALE_COLOR),
parameters: {
depthRange: [0, 1]
}
}),
Currently I'm not see any changes.
Never mind, read your code again -
const mapboxLayer = new MapboxLayer({ id: 'deck-gl-layer', deck: deckLayer });
should be
const mapboxLayer = new MapboxLayer({ id: 'scatter-plot', deck: deck});
@Pessimistress Please excuse me for confusing you with my typo in the example. Of course, I passed not the layer but the deckgl itself. I create working example: https://codesandbox.io/s/epic-paper-mem5b?file=/src/App.js
That issue can be relevant to this bug? https://github.com/mapbox/mapbox-gl-js/issues/7573
parameters: {
depthTest: false
}
The depthTest: false
parameter fixed the problem with water and flickering points. This is not a solution to the problem, because 3D extrusion is now displayed incorrectly, but it may be closer to understanding the problem of someone who understands it better than me
This may be related to how mapbox manipulate their layers' depthRange:
Description
DeckGl integrated in mapbox gl context as MapboxLayer render overlay that falls under a layer of mapbox water when bearing closer to 0. Video
Repro Steps
Create deck-gl layer and wrap it in MapboxLayer
I was also found that the problem DID NOT OCCUR in next scenario:
Environment (please complete the following information):
mapbox-gl@1.10.0
@deck.gl/core@8.1.9
@deck.gl/mapbox@8.1.9
@deck.gl/layers@8.1.9
Mozilla Firefox 77.0 (64-bit)
Chromium Version 81.0.4044.138
Fedora release 32 x86_64 5.6.15-300.fc32.x86_64