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

Get rid of multi-sample anti aliasing (MSAA) #219

Open
4 tasks
tuner opened this issue Jan 9, 2024 · 0 comments
Open
4 tasks

Get rid of multi-sample anti aliasing (MSAA) #219

tuner opened this issue Jan 9, 2024 · 0 comments
Labels
core Related to the Core package performance WebGL Somehow related to WebGL or GPU

Comments

@tuner
Copy link
Member

tuner commented Jan 9, 2024

WebGL's MSAA has a significant performance impact on large scatter plots like those in SegmentModel Spy. However, the actual scatter plot doesn't even need antialiasing, as it's using SDF-based shapes! With antialiasing, the full example data set when zoomed out is quite choppy with an M1 Mac but without antialiasing it's smooth.

image

Antialiasing is mostly needed for heatmaps that should have no gaps between the rectangles. An example of such a heatmap is the metadata in GenomeSpy App or the ideogram track. Without antialiasing, it looks ... badly aliased, particularly when animated. SDF-based edge-antialiasing kind of works, but the default blending mode causes visual artifacts and moiré effects.

On the other hand, MSAA is not perfect either, as it uses a limited number of samples. The following uses non-SDF rectangles, relying solely on MSAA. The banding is an artifact:

image

TODO:

  • Test if additive blending (GL_FUNC_ADD) would do the trick
  • If it does, add a blendMode mark property with an intelligent default value
  • Also fix the endpoints of "rule" mark, which doesn't properly do SDF at the endpoints
  • Set antialias: false for the WebGL context

If the above doesn't work, just make antialiasing optional, i.e., the embed method could have an options object with an antialias property.

@tuner tuner added core Related to the Core package performance WebGL Somehow related to WebGL or GPU labels Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to the Core package performance WebGL Somehow related to WebGL or GPU
Projects
None yet
Development

No branches or pull requests

1 participant