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

Sharper symbols with multichannel signed distance fields #3705

Open
wipfli opened this issue Feb 15, 2024 · 5 comments
Open

Sharper symbols with multichannel signed distance fields #3705

wipfli opened this issue Feb 15, 2024 · 5 comments
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@wipfli
Copy link
Contributor

wipfli commented Feb 15, 2024

I would like to try out multichannel signed distance fields (MSDF) because the should give us sharper corners for text letters and icons than the currently used signed distance fields. This issue is here to keep track of the current status and collect some material.

Overview

The basic advantage of MSDFs is that you get sharper corners. Here is an example from https://github.com/Chlumsky/msdfgen

image

From left to right: 16x16 MSDF, 16x16 SDF, 32x32 SDF.

In an MSDF you store 3 different signed distance fields in the 3 color channels of an RGB image. So this means you need 3x more data. However, the 16x16 MSDF still outperforms the 32x32 SDF in terms of corner quality.

To learn more about MSDFs I recommend reading this Master thesis

Goal

My goal is to have a proof-of-concept version of MapLibre GL JS which just shows a single MSDF letter on a map. Once we have this we can extend it.

@HarelM
Copy link
Collaborator

HarelM commented Feb 15, 2024

It's worth mentioning that the following issue talks about multi sdf a bit:

@HarelM HarelM added enhancement New feature or request PR is more than welcomed Extra attention is needed labels Feb 26, 2024
@wipfli
Copy link
Contributor Author

wipfli commented Feb 29, 2024

The demo here
image
can now show a single letter via the icon-image channel.

https://wipfli.github.io/maplibre-msdf-demo/#map=3/47/8

@wipfli
Copy link
Contributor Author

wipfli commented Mar 1, 2024

Great new blog post on msdf https://www.redblobgames.com/x/2404-distance-field-effects/

@wipfli
Copy link
Contributor Author

wipfli commented Mar 4, 2024

Large and sharp text in the Meta map style:

https://wipfli.github.io/maplibre-msdf-demo/meta#map=11.84/51.50079/-0.12431

Screenshot_20240304-220042

@HarelM
Copy link
Collaborator

HarelM commented Mar 4, 2024

Nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants