/ Work

UE4 - Material Digits

I need a surface that display digits depending on a parameter value. For that there is multiple choice, I decided to only have a material instance that do the job to display digits from 0 to 9. I took from a template digits and separated the different parts.



With a material, I created all the digits by multiplying the masks. I entered these digits in an array and depending of the parameter value I return the right digit.


Here is the small part of code in the custom node:

float4      array[10];
int         i;

i = 0;
array[i++] = zero;
array[i++] = one;
array[i++] = two;
array[i++] = three;
array[i++] = four;
array[i++] = five;
array[i++] = six;
array[i++] = seven;
array[i++] = eight;
array[i++] = nine;

return array[value];

Then it is possible to create a material instance of this material and enter parameters.


It is also possible to create a dynamic instance from a Blueprint or C++ code. In my case, I want to set the digit depending on the floor the elevator is.



R&D Software Engineer / Client Game Programmer - I am crafting video game prototypes during my spare time and if I really have too much time I take pictures and write posts for this blog.

Read More