We all know how to send video images from Aximmetry to Unreal, but there are time we just want to change the albedo of a material, not on every tick. For example for logo's or decals.
Of Course the best way would be to be able to change all the parameters, but here I will share a simple way to change the texture of selected objects at run time.
This will be done by sending text commands from Aximmetry to UNREAL.
The format of the commands would be
COMMAND1, arg1,arg2,.....;COMMAND2,arg1,arg2,arg3.... and so on and would be passed as text to Unreal.
At Unreal, we receive the text, Split by ";" to get each command and process each command separately.
You can send whatever you like that way. I will focus on implementing the TEXTURE command (or whatever you wish to call it)
STEP 1: create the compound in Aximmetry
The text is stored inside the TEXTS collection , with key = COMMANDS (of course you can change that) and we concat previous commands with the current command with a ; separator.
The compound just assembles the values
TEXTURE,TAG,SLOT,PARAMETER NAME
TEXTURE is the command
TAG is the objects that have a tag, and will be selected and processed by that tag.
SLOT, the slot the material is in
PARAMETER NAME, the name of the parameter the texture will change
The script will create a dynamic material instance of the material already those objects have, to avoid the complex procedure of selecting a material using object reference paths.
Here is how the pin collector looks like
and in the Control Board
We click the Texture button when all the fields are filled and we send the command.
STEP 2
On the Unreal side, we receive the text and if its not empty, we split it by ; and then for every string we get, we split by , (which is how we separate arguments). If the first entry is TEXTURE (which is the command we are talking about now), we call the following function.
https://blueprintue.com/blueprint/qo1uw_e1/
I am looking for ways to do it for all the available parameters, but the ideas I came up so far and not that appealing.
Enter a tag, with a press of a button generate a json file with all the parameters and values of the attached material, change them by hand and then press texture, to apply the changes.
Hi Buffos,
Thank you for the tutorial. Nice way to do everything from just one Control Board panel and using tags in Unreal.
Note, that you are not saving much by not setting the dynamic material at every frame. Unreal doesn't push it to the GPU memory at every frame just because you call it at every frame.
Warmest regards,