-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Custom layer with renderWorldCopies #9759
Comments
@zakjan , we don't have a good way of doing this currently. We currently achieve the The analogy for a custom layer would be having multiple model matrices for your custom layer object. However since we don't provide separated model, view and projection matrices from the custom layer interface, this is tricky to achieve. |
I have found an undocumented way how to do it currently, without any more matrices. In prerender/render, I get the world offsets with:
This returns for example Then I render my shaders multiple times for each world offset, pass it as a uniform, and add Is this a good solution, or would you recommend anything better? I'm worried about the way to get the world offsets, because It seems that it would be helpful if a function to get the world offsets is provided as a public method officially on its own, unrelated to custom layers. |
Closing, I have switched to simple |
@zakjan Any chance you could throw an example into a codepen/jsfiddle? I would like to be able to do the same thing. Much appreciated! |
@zakjan I would also be interested in how to apply the Thanks! |
Here is my solution:maplibre/maplibre-gl-js#4614 (comment) |
mapbox-gl-js version: 1.10.0
Question
Custom layer receives the transformation matrix in prerender/render functions for a single world only. When renderWorldCopies is true, how do I get the transformation matrix for all rendered world copies? So that I could render the copies of the custom layer as well.
Links to related documentation
https://docs.mapbox.com/mapbox-gl-js/api/properties/#customlayerinterface
https://docs.mapbox.com/mapbox-gl-js/example/custom-style-layer/
https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/
The text was updated successfully, but these errors were encountered: