/ 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.

digit-numbers

alldigits

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.

nodes

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.

digits

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