PAIR-code / megaplot

Apache License 2.0
19 stars 5 forks source link

Implement antialiasing #80

Closed jimbojw closed 2 years ago

jimbojw commented 2 years ago

Fixes #79

Before:

Screen Shot 2022-10-20 at 1 15 58 PM

After:

Screen Shot 2022-10-20 at 1 18 14 PM

The above images use a synthetic devicePixelRatio of 0.1 so that it takes 10 logical pixels to fill 1 synthetic device pixel.

They also have artificially set the canvas's image-rendering attribute to pixelated. Without this, the browser would soften the rendered canvas image with bilinear resampling.

jimbojw commented 2 years ago

Sorry for the late addition of the Scene level antialiasingFactor. PTAL.

jimbojw commented 2 years ago

Per offline conversation, eventually it would be better to have the antialiasing factor be a sprite attribute. This would allow, say, glyphs to have a different antialiasing factor from scatter plot points.

Currently, Megaplot does not have a good story around non-zero default values. Since the default antialiasing factor really ought to be 0.5, it makes sense to hold off on adding one until there's general support for non-zero defaults. See #81