Is there a way to drive the RGB material values of a single object that has multiple instances from a csv file where the index of the object instance and the index of the rgb values from the csv align?
Cheers
Is there a way to drive the RGB material values of a single object that has multiple instances from a csv file where the index of the object instance and the index of the rgb values from the csv align?
Cheers
Yes there is a way.
Your problem is basically two (and quite standard) tasks:
However i ma not really certain:
do you want dynamic instanced materials, or bunch of instanced not dynamic materials?
So, all you want is to read those numbers and create instanced materials out of them.
Or you want to read those numbers and have them dynamically changing during runtime?
Because for reading bunch of CSV numbers then making batch task in editor that creates bunch on instanced materials. You need to watch tut about making blueprintable unreal editor tools.
For that tool all you need is event that you can trigger from actor that holds that mesh from picture. Event should create instanced materials in some folder, then apply them to meshes or components or material slots in mesh.
Get CSV into data table:
instanced materials:
And for tool that processes it all:
in that event: read that CVS into table
And i just asked my Yellow Rubber Duck about whole task (and checked if it is not total derpy derp ajj).
This is rubbers duck reply:
Create and save multiple Material Instance Constants on disk:
Edit > Plugins > Editor
)Then restart the editor.
Variable Name | Type | Details |
---|---|---|
MaterialTemplate |
MaterialInterface |
Expose On Spawn |
OutputFolder |
String |
Default: /Game/Materials/Instances |
ColorArray |
LinearColor Array |
Colors to assign |
ParameterName |
Name |
Default: ColorTint or your param name |
GenerateMaterialInstances
Inside your EUB, add a custom function (or just logic in Run
if you prefer) with the following:
ColorArray
(using For Each Loop)Inside the loop:
Create Asset
"MI_Color_" + Index
OutputFolder
MaterialInstanceConstantFactoryNew
MaterialTemplate
NewInstance
Set Vector Parameter Value
NewInstance
ParameterName
LinearColor
Save Asset
(optional if you want to be safe)Looks mostly correct, however that worst part about chatGPT, answers always look correct then it does totally bogus error in middle of all of it. But at least you have general idea described step by step.
Legend, thanks so much mate