How to : Dynamic Player Name and Number in a sport game ?


I’m currently working on a sport game using UE4 and blueprints.
I would like to have the name and number of the player added to the jersey material.
So far I have not found a way to do it so if anymone can give me any direction that would be gold.

Idealy, I would like to have a character editor menu similar to what you can find in UE4 games like Supercross the game or MXGP.

Cheers guys !

Still searching for a way to do this. Any help would be appreciated. Thanks

Make flipbook texture with all digits.
Then make material that display given number. Make this with texture scaling and shifting it.
First make for single digit, then combine 3 such sections into one 3 digit string.
Names would be bit complicated to do this way.

When you have material that displays numbers, use again UV scalling and shifting to place that number material in right spot.

This all can be done with just materials.

However for that right look of number (various sizes depends on digit etc), you should consider just making name with number and storing that as texture per player.

And yes in text based shaders i could just copy paste code after googling some.

1 Like

Ok i have some time, i will try to make such material for you in some stages (just like i am creating it), hard to get to last stage without creating simple versions:

This is simplest material that can potentially create what you need.
You need texture with numbers 0 to 9, in 4x4 grid yes not all slots will be used.
I googled such texture, and i am not sure if its copyright free, so you get only material.

Now working on second step: material that will display number from that texture using only 0…9 integet (combine x and y inputs)

1 Like

Now second material calculates Position X and Position Y from number you give it:

And now hard part for me: creating proper 4x4 flipbook texture with numbers :smiley:

1 Like

Little next step:

I created two textures:

This should be inverted, but that can be fixed with “one-minus” node:

This is mask to cut out unecessary digits

As result you should get single digit in upper left corner of material.

1 Like

Now move all inside material function:

And I messed up something :wink:

Will post more if i find bug tomorrow.

1 Like

Hi Nawrot,

Amazing, thanks a lot for your time I really appreciate.
I kept searching for the best solution and one guy on a discord channel told me without any more precisions that he did it using a render target with 2 text layers and saving the result as new material.
He told me that it also allows using different font etc.

I’m yet not sure how to set this up and need to learn more about render targets.
But I will for sure try your solution too.

Yes render target would work,
However my solution is not finished (done half way trough)
I could not modify UV coordiates for digits to properly display, there is some error in cvalculations.
And i cannot find where.

This also can have different fonts, you just need to make textures.
However for digits and alpha, they will be quite big if you want any decent looks.

This can work for displaying logo, emblems etc, where you have to display single picture out of 16 :smiley:

Yeah I saw you were not finished but it still gives me a good starting point to learn from, thanks for that.