threebox icon indicating copy to clipboard operation
threebox copied to clipboard

The custom layer is under the building layer

Open limzgiser opened this issue 6 years ago • 7 comments

Can someone help me,Why can't I move the layer above the building layer?

limzgiser avatar Dec 16 '19 11:12 limzgiser

I've same problem with mapbox version > 0.54

Have you found a fix ?

zearg avatar Jan 21 '20 14:01 zearg

Same problem here...doesn't seem to be an issue with custom-layers generally

joedjc avatar Jan 22 '20 22:01 joedjc

There is more information in this issue: https://github.com/mapbox/mapbox-gl-js/issues/7395

peterqliu commented on 16 Nov 2018

[...] The custom layer draws within the context of the 2D layer stack, regardless of whether the layers themselves are 3D. For proper depth testing, you would put all 3D elements into the same custom layer

zearg avatar Jan 27 '20 12:01 zearg

You can add

gl.clear(gl.DEPTH_BUFFER_BIT);

in render() of layer in first position (before all actions in this function). But three objects will be always above buildings.

After tests, CameraSync is the thing that 3D depth calcul isn't working. Maybe this.camera.matrixWorld.copy() or translation of the world group... i don't know.

I think i will create a world group, positionned at 0,0,0 and translate camera instead of translating world group. Difficult is to convert world coords to and from lat/lng.

zearg avatar Feb 05 '20 07:02 zearg

map.moveLayer('id1','id2')

sys2007 avatar Apr 20 '20 03:04 sys2007

yes i got same issue after using gl.clear(gl.DEPTH_BUFFER_BIT); , also i tried to change ordering nothing work correctly. here a screenshot: Screenshot (18)

anyone solved this issue?

adelchamas96 avatar Apr 30 '20 07:04 adelchamas96

Hi @adelchamas96 , @limzgiser , @joedjc I I have solved this problem at my fork fine tuning the CameraSync object. image image

jscastro76 avatar Jun 18 '20 16:06 jscastro76