Better Quality Text in WebGL

后端 未结 3 1313
无人及你
无人及你 2021-01-30 02:00

I am searching a method to draw better quality (arbitrary) text inside WebGL. Currently I am using bitmap font rendering on a 2D canvas and blitting them into the WebGL context.

3条回答
  •  佛祖请我去吃肉
    2021-01-30 02:39

    Pixi.js agrees with the recommendation above for SDFs.

    https://github.com/PixelsCommander/pixi-sdf-text

    They say (and they're an excellent gaming project for the browser)

    SDF is the most efficient way to draw text in WebGL. It uses special kind of raster atlases and GLSL shader to draw vector scalable text in a very performant way on GPU.

    And this was from MapBox who at least has done it too at some point.

提交回复
热议问题