Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sortByDistanceToCamera doesn't work for PointLayer #2488

Closed
joric opened this issue Jan 2, 2025 · 2 comments
Closed

sortByDistanceToCamera doesn't work for PointLayer #2488

joric opened this issue Jan 2, 2025 · 2 comments

Comments

@joric
Copy link

joric commented Jan 2, 2025

maptalks's version and what browser you use?

maptalks-gl v0.105.3
chrome

Issue description

The VectorLayer option sortByDistanceToCamera: true doesn't work for PointLayer (and/or GroupGLLayer).

All image markers in PointLayer render in random depth (or rather, in the add order), it's a big issue.

Tried orderByCamera: true from GroupGLLayer.ts, it doesn't work either.

Tried adding markerAllowOverlap: true, to symbol and collision: true, to layer, the order somehow inverted but still wrong.

Observed with markers that are in the same layer, so it doesn't depend on other layers.

It worked for VectorLayer just perfectly. Do I need another option? Something zBuffer-related, perhaps?

Please provide a reproduction URL (on any jsfiddle like site)

https://joric.github.io/stalker/

@joric
Copy link
Author

joric commented Jan 4, 2025

@fuzhenn please help. That should be implemented already, shouldn't it? I just cannot find an option to enable it.

@joric
Copy link
Author

joric commented Jan 20, 2025

@fuzhenn I think I made it work using sceneConfig property:

    layer = new maptalks.PointLayer(layerName, [], {
      // ...
      sceneConfig: {
        depthFunc: '<=',
      },
    }).addTo(groupLayer);

But it was really confusing that it doesn't work by default. Should be well documented somewhere, it's really one of the first things you expect from the pointLayer.

If you set it on group, it doesn't work, must be set individually for each layer. Multiple layers in group appear to use common z-buffer so markers render with correct depth across all layers. Not sure how to make them explicitly overlap though.

I'm yet to check all the cases like overlapping vector geometry but it was a big step forward and it took 2 weeks to figure out, I discovered it by accident in the Chinese documentation here https://doc.maptalks.com/docs/api/vt/point-layer/

@joric joric closed this as completed Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant