-
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
maybe switch to quads for icons #491
Comments
It looks like there are good reasons for both. The current icon shader uses 8 bytes (vertex) + 2 bytes (element) = 10 bytes per POI icon, while the text shader uses (4 * 16 bytes (vertex) + 6 * 2 bytes (element) = 76 bytes per Glyph. We could reduce the usage for icon-specific buffers to 12 or even 8 bytes/vertex. While this sounds really large, it might still be okay; a thousand icons only take up 76KB of buffer space. What's more important, moving the icon dimensions to the buffer allows us to draw icons of different size with one draw command, which is probably more efficient than saving a little buffer space. BTW, I don't think combining icons and glyphs is possible in the short term, because the shaders are vastly different: we need to do the SDF alpha testing and linear interpolation for glyph images, but don't want linear interpolation, and only straight texture mapping for icons. |
The combining suggested in the other issue is just processing them together, in the same render type, to solve placement issues. They would still be drawn with two draw calls. The fragment shaders would be different, but vertex shaders would be identical. The switch will make fading points possible. I don't think we need to worry about performance drawing icons with quads because there are way more glyphs already being drawn with quads. We can check later once we have a good way of benchmarking. |
native issue: mapbox/mapbox-gl-native#356 |
* render test to capture issue * forgotten to move back caculations to fragment shader * review fixes and opacity multiplied in fragment now
Icons and glyphs are very similar. The only differences are where their bitmap comes from and whether they are sdfs. sdf icons will also be supported at some point. Both are sometimes aligned with the screen (horizontal labels and icons) and sometimes rotated with the map (one way icons, road labels).
Icons and glyphs are currently drawn differently. I think they should be drawn the same way. Should icons be drawn with quads? or if drawing with gl_point is better, should we change how glyphs are drawn?
This would be nice to handle as part of implementing mapbox/mapbox-gl-style-spec#67
@kkaefer
The text was updated successfully, but these errors were encountered: