Download

Creating text meshes

Hello!

I want to create in my project 3D texts like that:

As Unreal Engine doesn’t support creating geometry from blueprints, I’ll need some workaround to achieve this…

First, I thought I could create my texts directly in Blender and import them in my game. > Bad idea, if I want to create a multi-lingual project, I’ll need to recreate meshes everytime.

Then I thought I could create every letters then import them and create blueprints to build them. > Once again, it’s probably a bad idea. What if I want multiple fonts? Bold? Italic? It will be way too heavy to create all letters…

So now I thought I could use materials…

Basically I could use a masked material and draw letters on the surface, and add depth to that material… Which doesn’t seam to be possible as material only affects surface.

Do you have any other idea how could I create 3D Text meshes?

Thanks!

I’ve done this. I created a complete character set using the free softimage mod tool - I made a script that creates each character of a font in 3d, then labels that mesh by its ANSI number, then, using a blueprint,I can get the ANSI number of each character in a string then spawn a mesh based on that number, offset by the width of the previous character.

That’s a good idea, thanks!

I’ll try to use Blender scripts for that :slight_smile:

Hope it’s going well. although this teqnique works for me, I’m storing the paths to each character in a csv data table - the problem with these is that when you restart the editor, the data table nodes all disconnect and break the blueprints. If you can find a better way to store the asset paths I’ll be interested to hear about it.

So here’s how I do it:

I created a node “Load Static Mesh from Path”, available here (by Rama): https://wiki.unrealengine.com/Dynamic_Load_Object

And in the path I just specify this FName: “Static Mesh’/Game/Shapes/Letters/SM_Letter_XXX.SM_Letter_XXX’” (actually I tweaked the C++ function so I don’t need to specify twice the name etc.) XXX is the ASCII number of the letter (Node Get Number From Character).

Then I just add the static mesh and add a relative offset from the letter bounds. (Get Actor Bounds node). That’s it!

Regarding the meshes, I could make the Blender Python script working. Unfortunately the wireframes aren’t that good, I could use Smart UV Project which auto creates a UV Unwrapping but some joints aren’t really nice. Are UVs better with Softimage?

Good old Rama! That’s great to know he’s done that - you’ve actually saved my sanity with that (i’ll try it later).

Softimage has some pretty good extrusion/bevel effects which is what i’m after. I haven’t been mapping my text though - i’ve been using a simple texture on them.

Thanks for the info - i’ll let you know how it goes.

Dan.

OMG - i’m such a C++ newb.

I’m fine with blueprints and I’ve already done the relative offsety stuff - i’m actuallty working on a multi-line version at the moment - but my method of using a CSV table to point to the static mesh path falls over whenever I restart the editor. I’m pretty lame at C++ - there are always code examples for things, but I can never work out if it’s supposed to go into a .h file or a .cpp file or what.

So, in this case, did you just put the dynamic load function and some sort of UFUNCTION into a .h file?

I’d be really appreciative of any help you can offer here.

Dan.

I’m pretty new to C++ too, but once you know how to create basic new nodes, it gets quite easy.

First if you haven’t created C++ files for your project, generate them by right clicking on the .uproject and click Generate VS files.
On the Editor, click on File, add code to project, and use as parent class BlueprintFunctionLibrary (I named my file UtilityNode):

Then I’ll give you directly the content of my header and source files:

Header file: (Where you define your functions):

And the .cpp file:

(Replace YOURPROJECTNAME by yours)

You can have more informations about BP nodes here: https://wiki.unrealengine.com/Custom_Blueprint_Node_Creation

Thanks so much Shelby - I can’t tell you how chuffed I am with this. I was about to embark into the realm of C++ - and i’d have got it really wrong before I made progress. I still intend to learn it but thanks for the head start.

Dan.

Hey Shelby, and Dan!

Could you share the blueprint you’re using to get the Unicode of each character? I seem to only be getting the code for the first character in the string.

Any other blueprints for this would be appreciated too.

Hi Haxo,

The function is Get Character By Number, which returns the ansi value of a character. You can loop through a string with a for next loop going from 0 with a string len function plugged in to the last index node - then loop through each character which you can put into an int array in order to build your string.

Dan.

Thanks! I will try this out tomorrow!

//Sorry, I am new to C++. What is the “Utility node” doing in relation to the “Load Dynamic Mesh from Path” node?

Alright, I got that figured out. Now storing all of the ANSI characters in an array.

How did you attach the ‘Load Static Mesh from Path’ node to the ‘Add StaticMeshComponent’ node?

Ok, so I couldn’t get the load static mesh from path to add static mesh component working. So instead I used a switch and got the bounds of the model, added the kerning/spacing, and placed the next mesh based off of that.

Its a bit redundant but it gets the job done!

Hi, I’ll reply to this but your method is a bit clunky there, you should use arrays and loops more. If you use the static mesh from path function you can construct a path by concatenating strings (appending in UE) so you import each character mesh into a folder then make a path to that object based on whatever ansi number you get from the string. I’ll make some blueprint grabs when I’ve got a moment.

Yea, I got the string all set up, But I can’t connect the output of the static mesh from path to the target of the add static mesh component. This is working, but I agree it is clunky. I cleaned it up a bit today with macros.

Those blue lines never seem to match up. Without context sensitive working or a conversion I admit I am lost.