visgl / deck.gl

WebGL2 powered visualization framework
https://deck.gl
MIT License
12.2k stars 2.09k forks source link

Hidden surfaces elimination in ArcGIS's `DeckRenderer` extension is not implemented #4596

Closed damix911 closed 4 years ago

damix911 commented 4 years ago

This is being worked on in #4597

Description

@deck.gl/arcgis's DeckRenderer (i.e. the deck.gl extension for ArcGIS's SceneView component) does not seem to cull hidden surfaces with certain 3D models. It was known (the 3D integration between ArcGIS and deck.gl is not even documented yet) but we were waiting to fix other issues before working on that (like camera alignment). It has been re-discovered by the devs working on I3S but we don't think that it is specific to I3S. I think I would like to fix this first, it would make working on camera alignment less frustrating.

It should look like on the right, but with 8.1.0 and even in master it looks like on the left. image

Repro Steps

Go to this pen https://codepen.io/dawken/pen/KKdGRvx and see that it does not look right.

Environment

Logs

Mainly these two errors in the console, but believed to be unrelated:

[esri.views.3d.support.cameraUtils] #scaleToZoom() Cannot compute zoom from scale without a tiling scheme
dist.min.js:11 deck: WebGL2 not supported by this browser. Transition animation is disabled.
damix911 commented 4 years ago

I did a very rough analysis of the problem.

I think that this could be an issue with Tile3DLayer not enabling depth testing.

If you look at the code for ScenegraphLayer for instance it does not enable depth testing explicitly.

On the converse this ElevationLayer here, does enable it.

Now, if you look at the initialization code for the entire Deck, it seems like it is enabled at the top level. So maybe this is why also the layers which are not enabling it explicitly can get away with it.

But in the ArcGIS SceneView case this does not work anymore because SceneView resets the GL state to default before handing control to the ArcGIS external renderer which in turn delegates to deck.gl.

WDYT?

Pessimistress commented 4 years ago

This is similar to issues that the @deck.gl/mapbox module encounters, where deck.gl is sharing a WebGLContext with an external library.

https://github.com/visgl/deck.gl/blob/96ebcf3065c232d3719e853be6ed8bbb06399518/modules/mapbox/src/deck-utils.js#L22-L27

I think the proper fix is to assign the parameters prop of the Deck instance, which will be re-applied whenever Deck is about to render.

Pessimistress commented 4 years ago

Fix landed in 8.1.7