MeshWriter or TextBlock?

Hi! This is my first post, hopefully I am doing everything right.

I am working on a small project where I need to put strings (text) above some meshes (not on the mesh itself, but with a y offset so that is always positioned above the actual mesh) with high quality and readability.

Until now, I am aware of two possible solutions. The first one is MeshWriter while the second is TextBlock.

Now my question, first of all, I am aware that MeshWriter is an extension and hence not officially supported. Being not officially supported, you need to import stuff in a way that I don’t really like (e.g. require('meshwriter') even if I wan to use import {} from 'meshwriter'). Anyway, after having imported the library I have encountered a problem:

TypeError: I.addQuadraticCurveTo is not a function

Here the first question, I do not see that method anywhere in the source code. Should I suppose that’s deprecated hence also MeshWriter is not usable anymore?

On the other hand I know there are TextBlocks, and I could create empty boxes and put some dynamic texture on top of it, position the new block above the target mesh, and put the TextBlock over it. The only thing is that I see that the quality of the TextBlock is kind of low and I am also scared that will impact performance since there will be multiple phantom blocks with dynamic texture and TextBlocks.
Which is the best solution to put text in a 3d World? I am right with this reasoning? Are there other options?

Thank you in advance!
F

Hi @Pfahlf and welcome to the forum. Weekends tend to be a bit slow here so sorry for any delay in answering.

If your labels are just that and not part of a GUI there is another way using one dynamicTexture and the solid particle system. Here are 72 labels placed at random https://www.babylonjs-playground.com/#A9K31I#5.

You could adapt this to position the SPS labels next to a range of meshes should you so wish.

1 Like

@JohnK that’s awesome! Thank you for letting me know of this possible solution, I do not know why it didn’t come op on my radar! And no worries about the late answer, at least I learned something new today :smiley: