peterqliu / threebox

A three.js plugin for Mapbox GL JS, with support for basic animation and advanced 3D rendering.
MIT License
528 stars 320 forks source link

The custom layer is under the building layer #80

Open limzgiser opened 4 years ago

limzgiser commented 4 years ago

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

zearg commented 4 years ago

I've same problem with mapbox version > 0.54

Have you found a fix ?

joedjc commented 4 years ago

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

zearg commented 4 years ago

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 commented 4 years ago

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.

sys2007 commented 4 years ago

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

adelchamas96 commented 4 years ago

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?

jscastro76 commented 4 years ago

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