Skip to content

Render glyphs with GLSL for hinting + anti-aliasing? #162

@snickell

Description

@snickell

I'm guessing one of the major use cases for Primrose is (as I'm using it) rendering a text editor in XR, where pixels are jenky and ginormous. Displays were of course all 100% jenk in the 90s and a couple techniques from that era might be of interest:

  1. truetype hinting (snapping 'ink' to the pixel grid to produce fewer grey pixels)
  2. sub-pixel antialiasing (leveraging the RGB sub-pixels to gain a ~30% - 50% edge resolution boost in one axis on some headsets)

To apply these you have to know where the pixel grid is relative to what you're rendering, which really calls for a pixel shader in the webgl context. IMO, applying both of them can significantly boost text readability in XR, I've been playing with the very cool https://github.com/astiopin/webgl_fonts as a starting point.

Is that something you might be interested in for Primrose? Could you suggest where in the primrose source this might make sense to play with? So far I haven't narrowed down on where in the source glyph rendering is done, guessing its SDF or one of the variants? Obviously this would change how the rendering was done, passing a text buffer with layout coordinates to a GL shader rather than SDF glyph textures with coordinates....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions