Hey, Im currently in need of multiple simple text labels in my WebGL rendered scene. I’ve gone through this topic probably two years ago already and it seems not much has changed from there.
I found a few techniques.
-
Either you could create a Canvas, draw some text on it, make a Texture from Canvas, make a Sprite from the Texture and use it in the scene.
This approach seems to be pretty performance heavy for me, because I need to update the label value constantly. -
Or you could make a HTML Element and project its position from 3D to 2D.
This is pretty straight forward, but also has its flaws. The HTML is always overlapping the webGL canvas and is not nested in the webGL scene. -
Its probably possible to add a CSSRenderer and render a second scene on top of the other, but Im not sure if itll lead into other problems, like missing events? Also this seems to be pretty performance heavy.
Whats the best and most performant way of creating updatable 2D text labels with webGL?
Any help appreciated