I’m working on a blueprint which heavily relies on instances of static meshes. What I’m currently struggling with is that material overrides that I set in the InstancedStaticMeshComponent do not seem to have any effect (only the material originally assignes is shown). I have assigned a specific material (some materials are also instances) for each instanced mesh.
So you are dynamically creating Static Mesh components in a blueprint, are you then setting their materials? If you can post a screenshot of your Blueprint and I can see how we can help you get this sorted out.
Sorry for the initial confusion but I understand the problem now. The rendering drop down for the Instanced Static Meshes is not so you can set the material for each instance. The Materials 0, 1, 2, etc. are referring to separate material slots for the same mesh. Here is an example for you, I have a cube in which the top and 2 front faces are separate material slots and you can see in rendering I have the 3 materials set up.
Hi eric, just to clarify: is it even possible to apply different material instances to instanced static mesh components as he is trying to do here? In my exploration, this doesn’t seem to work (the material gets set on all the instances). Just wondering what the expected behavior is.
Unfortunately, no. The reason being that by setting a different scalar value per instance the rendering thread would have to treat the instances (draw call wise) as the same as if they were not instances thus defeating the performance gains by using instances over actual meshes.
The engine does have a perInstanceRandom node in the Material editor which allows a random float value to be passed based on instances. This node is somewhat limited in scope (every time you use the node in a single material each use will return the same value) and while it does incur some performance cost in use because of its limited scope it is still allows the engine to utilize the instance rendering pathways.