Material Custom Instanced Data - Can You GET Data Once Set?

Hi,
I am using the perinstance custom data option within a material. I am using this material on a box mesh which is instanced, they form a grid.

Each instance is given its own color in BP and all that works fine. I use the “Set custom data value” node so have access to the index of each instance. Perfect :slight_smile:

However, besides being a nice tool to color instances I was under the impression the whole point was to be able to store data in the color material opposed to a traditional variable.

That doesnt seem to be the case as I have no way, as far as I can tell of getting any of the instances to pass me their color data. I can set it anytime I wish but apparently getting the information back from an instance seems impossible. Which surely cant be the case.

What I was expecting to find was a “Get Custom Data from Index” node but apparently there isnt one.

Any help in this area is appreciated. This was all in 5.3. Perhaps 5.3.1 is different.

if you make a dict (map) you can essentially do what you are looking for. it wont be attached to the instance specifically, but you will be able to look up the color via the index.
alternately you can make an an array sized to match the amount of instances, and put the color in the same index as the instance index. this is faster than an dict, and probably what i recommend.
both methods requires some management so the array/dict can stay synced up with the ISM component, but that’s not too bad.

1 Like