Per Instance Id For Static Mesh Instances
I'd like to access the unique instance Id of each static mesh instance.. is there a way to do this? This would be similar to the value passed in via the SV_InstanceId semantic.
Is there a way to do this? I've tried adding a custom HLSL node to my function, but it doesn't look like the instance id is avaliable in the generated function.
asked Aug 02 '16 at 06:42 AM in Rendering
You can retrieve the index of a given static mesh by using the "Hit Item" output pin (int) from a hit result. Then you can use that to get the particular properties of that instance (such as its transform) after you have casted to the InstancedStaticMesh class from the hit actor.
See this tutorial for details: https://youtu.be/F_RS1vlBYXI?t=822
Also, if you are talking about accessing the index from within the material, there is a material node that will get a random number out of the instance index and that will help you to randomize your looks a bit.
As for passing parameters to the material instance of a particular instanced mesh, remember that they are all the same draw call and are sharing the same material, so you would be affecting them all.
answered Aug 02 '16 at 10:54 AM
Is there a solution to this problem? I have the same problem.
answered May 16 '18 at 06:16 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here