UE4 pass different data into loop cycles in Custom node?

Hi guys :slight_smile:

Im a bit struggling with a task:
I want to pass some different data, i.e. different textures, float/int into HLSL code written in Custom node and made it per every loop cycles one by one, ie:
Actor#1 - set values for some function argument for loop 0
Actor#2 - set values for some function argument for loop 1
Actor#3 - set values for some function argument for loop 2

Total amount of Actor in the scene defines loop ā€œiā€.
Actors can be spawned, deleted in the scene randomly, spawned by user, numbers of Actors can vary during gameplay.

So let say we have 2 spawned Actor:

  1. it means loop i=1 (we would have 2 loop cycles).
  2. for loop i=0 we will pass data from Actor#1, It would be some texture which Actor#1 contains.
    We put those texture into loop 0, make some calculations.
  3. for loop i=1 we will pass data from Actor#2. It would be some texture which Actor#2 contains.
    We put those texture into loop 1, make some calculations.

TBH with my current knowledge this task looks doable only if i:

  1. hardcoding total possible amnount of loop count.
  2. create all needed inputs for code in Custom node, i.e. texture1, texture2, texture3, texture4 and so on.
    So in case i think what total loop count can be 8 i will have 8 texture inputs, 8 float inputs and so on.
    So in practice example it would work as:
    If we have 3 Actor in the scene, i define ā€˜iā€™ =2. I take texture reference from Actor#1 and set it as texture1 input, texture reference from Actor#2 as texture2 input and so on.
1 Like