Open brunoabinader opened 5 years ago
From Slack, @ansis commented:
Hmm, although that is a slightly surprising usage it sounds like there is a bug caused by not adjusting the sdf blurring distance for the scaled size. I think this should be fixable. Can you open an issue and tag Chris?
Passing variable halo distance (or really, variable text-size) to the shaders would require us to do something like a paint property binder whenever we used format expressions. The current implementation takes advantage of being able to implement "font-scale" purely by changing the layout vertices. This has the advantage that no extra data has to get passed to the GPU to support multiple "scales" in a single draw call, but leads to these artifacts with large font-scales. See discussion at https://github.com/mapbox/mapbox-gl-js/pull/6994#issuecomment-407230046.
Putting an explicit limit on font-scale might help guide people in the right direction here. Maybe .25 <= font-scale <= 4
?
I think text-size is already always data-driven so baking it in there wouldn't require any extra binding. I'm not familiar with the formatted text implementation. Would it be hard to implement it with this?
You're right, I think we can do it that way.
Given the following
style.json
render test example:In the example above,
text-size
is set to 1, whilefont-scale
is set to different values. This generates downscaled SDF textures that produces unreadable results.Rendered result:
/cc @ansis @ChrisLoer