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

SampleFill faulty rendering on different browsers #18

Open
maeneak opened this issue Jun 4, 2019 · 8 comments
Open

SampleFill faulty rendering on different browsers #18

maeneak opened this issue Jun 4, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@maeneak
Copy link

maeneak commented Jun 4, 2019

Tiles are not rendering at certain positions and zoom levels on different browsers. Seems to be fairly random. Can be reproduced using the current demo at https://astrosat.github.io/windgl/

@gampleman gampleman added the bug Something isn't working label Jun 4, 2019
@maeneak
Copy link
Author

maeneak commented Jun 5, 2019

Im fairly sure this is relating to the tiling. When the tiles do display they display correctly along all longitudes but only on 90deg section along the latitude. Strangely the latitudes are different on different browsers. 90N to 0 in firefox and 45N to 45S in chrome and edge. My guess would be computeLoadableTiles() as it is overriden in particles which is functioning as expected.

@maeneak
Copy link
Author

maeneak commented Jun 9, 2019

There's quite a lot going wrong with this. I've identified definite issues with the tile calculations in layer.computeVisibleTiles() but even when fixing this the problem persists. I'm convinced this is a shader issue, possibly relating to the reprojection functions, but my GLSL skills are sketchy at best.

@gampleman
Copy link
Contributor

Yeah I've noticed that as well. TBH I'm fairly convinced that some of these issues might even be in mapbox itself, although it's hard to prove. I've even seen inconsistent behavior based on different screen sizes.

As a workaround, it's probably best to specify a reasonably high min-zoom.

@maeneak
Copy link
Author

maeneak commented Jun 11, 2019

I can confirm this bug is in the Projections in the Shaders. Changing the vertex position to worldCoordsWGS84 from worldCoordsMerc extends the tiles the full lat range but puts the projection out. Might need someone with a better understanding of the code to look at this.

    v_tex_pos = worldCoordsWGS84;
    gl_Position = u_matrix * vec4(worldCoordsWGS84, 0, 1);

@maeneak
Copy link
Author

maeneak commented Jun 25, 2019

So i managed to find a pretty nifty little hole/hack in the mapbox-gl source code which allows me to use the built in mapbox tile system to feed textures to custom shaders from a custom layer. I've created a repo with a simple demo, this would be a good fit with this project and would eliminate many of the alignment and browser related issues. Mapbox takes care of all texture loading, tile matrix calculations, projection and tile caching which will reduce the code base significantly.
Ill be using this method in my own project but will try to throw some time at a branch of the current master and post if i make some progress. This would obviously require a revamp of the py generator code (not my forte) but ill try to use static tiles from a WMS source as test data.

@gampleman
Copy link
Contributor

I found those hacks as well, but in this case we are using unprojected data, so the tiles end up being different.

@maeneak
Copy link
Author

maeneak commented Jun 25, 2019

Ahh ok of course. I'm using a tile server which is doing it on the fly. I'm sure there would be plenty of py modules that could do the projection in pre-processing? Anyway ill leave it for now 👍

@gampleman
Copy link
Contributor

Of course, but some of the math seemed easier to do correctly in WGS84 than in Mercator. Having now done the project, I think I might reconsider that decision, but at the time it seemed like a reasonable choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants