Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text Node
#1
I am currently evaluating SharpEngine for an upcoming project which makes use of a lot of text being displayed.

I looked through the API reference and samples and could not find any sort of "TextNode". In the samples a class is provided called "BitmapTextCreator" which seems to create a simple plane (or planes) with the characters rendered on it from images that are rendered from a font.

I was wondering if there are plans for a built in "TextNode"?

Also, are there any plans to make vector text instead of relying on a bitmaps? This would then also allow for 3D text (extruded vector text), or is there a way to currently do this that I am missing. If what I am saying is unclear I am referring to something similar to the text example from you PowerToys toolkit:

[Image: triangulated-text.png]
#2
Thank you for evaluating SharpEngine.

The SharpEngine is a cross-platform rendering engine so it cannot just simply render the fonts in the background because each OS provides its own way of doing that. 

This is much easier in Ab3d.PowerToys and Ab3d.DXEngine libraries that work only on Windows and can use WPF behind the scenes to render the text to a texture. This is used for the TextBlockVisual3D (Ab3d.PowerToys) that shows rendered text on a 3D plane. Also, this is used for InstancedTextNode (Ab3d.DXEngine) where individual characters are rendered to textures and those textures are then rendered to 3D planes by using instancing. InstancedTextNode allows rendering millions of characters. Also, the triangulator sample (shown in screenshot that you provided) can use WPF to get the font glyphs, convert them to polylines and then triangulate and extrude them into 3D objects.

As you have mentioned, the only option that is currently available in SharpEngine is BitmapTextCreator - it uses a predefined bitmap font textures; then for each text (string) it defines a mesh that will use the font texture and render the text to a 3D plane. This requires one Vulkan draw call per text. So it should easily render hundreds of different texts; even thousands of texts should work ok on a decent machine. But when you need to render millions of characters, then a solution based on instancing is required.

Currently, we are working hard to provide basic 3D functionality for the first production ready version. And the BitmapTextCreator provides the basic ability to render 3D text. Adding support for rendering text with instancing would currently take too much time, so this will need to wait for the future version - it will surely be implemented in the future.

If you would like to render extruded 3D text (as in the screenshot), then you will need to get the character data into application with SharpEngine. The easiest way to do that would be to use the triangulator sample for Ab3d.PowerToys - that would generate positions and triangle indices (after triangulating) for each character. Then you can save that to an .obj file with name of each object set to the character. Then in an application with SharpEngine you can read the obj file and generate mesh by extruding the triangulated data. Note that if you need to render many characters, then this method could be too slow.
Andrej Benedik
#3
Thank you very much for your detailed response. You have given me some options to experiment with.

It is also very good to know that you will most likely implement instancing in the future.
  


Forum Jump:


Users browsing this thread:
1 Guest(s)