I use instanced meshes for the individual building pieces in my game (I use the foliage system to do this).
I’m wondering if there’s any way to apply modifications to the material for the individual instanced meshes. For example if i wanted to allow the player to paint individual pieces different colors.
There is a material node called PerInstanceRandom, which gets a random value between 0.0 to 1.0 on a per instance basis. So it would appear the material editor can identify one instance from another.
You can see in this example (where the shapes are a single InstancedStaticMeshComponent painted with the foliage tool) the material is treating the individual instances separately (not world pixel position):
I can store extra data in each instance in InstancedStaticMeshComponent, by setting a float in the PerInstanceSMData[i].Transform.WPlane.W field (which doesn’t seem to be used by anything). If I could just access this data in the material editor, this would unlock huge potential…
Wondering if I could write some HLSL code in the material editor to get a value from the instanced component.