Is it possible to modify the texturing of instanced static meshes per object ?
More precisely, i have tried to modify the texture tiling of differents instanced static meshes, but i end up with always the same tiling for all of them.
I can modify their geometry though (scale, location, rotation).
Is there a way to get (instanced) meshes with different texture coordinate properties, or is this an unavoidable consequence of using instanced meshes ?
As far as I am aware, No. However you could see about just using multiple Instanced Static Mesh components and changing the textures on them. Not as good as 1 ISM but still better than 100s of normal static meshes.
The point of an ISM is that they are all using the same rendering data to expedite the process by not needing to clear the information on the GPU between each mesh rendered. It basically say “ok, I have my mesh and texture data, and then I just need to clear my transform data as I do this 100 times.”
What your asking to do would require it to recalculate the texture to be applying between rendering, which is the highest memory cost (usually).
Sorry I dont have a better answer for you, but hope you also understand ISM a little better.
May an infinitesimal change to the object’s scale and use that to select between different properties. Basically drive properties by encoding a small selector into the the scale values.
I have a similar problem and this sounds like a perfect solution for me. However I can’t get a hold of the per instance scale. There is an object scale node in the material editor but it returns the scale of the instanced mesh component not the scale of the actual instances. Do you know how I get the scale of the instances in the material editor?
Hi, I ended up needing this and looked into it further.
I think scale is only easily available for instanced foliage. In the perinstancedata there is a transform matrix that you could get scale from with the custom material node and some math, but I found an easier way: modify the code so that the value of “PerInstanceRandom” can be manually set instead of generated from a random seed.
Then you can just pass your data directly in. PerInstanceRandom is one component of a halt4, so it is a half-precision float. You should be able to have around 2048 unique integers to encode things with without much work.
The initialization from a random seed is done in: FStaticMeshInstanceBuffer::Init
This is an old post, but as I couldn’t find solution anywhere on forums I will post my solution in case someone else is looking for that.
There is material node PerInstanceCustomData. To pass different data per instance we can use “Set Custom Data Value” node in blueprint: