I’m experimenting with instanced mesh rendering via UInstancedStaticMeshComponent and UHierarchicalInstancedStaticMeshComponent and running into some problems with instanced meshes smearing due to TAA and TSR antialiasing options.
In my project I have a large number of entities which I simulate, and then use their location/rotation data to batch update instanced static mesh components. This works fine except for severe visual artifacts when the instanced meshes are moving, if I have temporal AA options enabled.
If I visualize motion blur I can see that the instanced meshes are detected (they show up as yellow in the motion vector visualization) but their motion vectors are zero.
I’m not currently doing anything to supply instance velocity information to the instanced static mesh components, so maybe I need to do that?
Before I investigate further, I thought I should ask the community because this seems like it would be a very common and major issue with instanced meshes. Is this a known issue, and is there a standard solution?
A simpler question to ask perhaps is, do UInstancedStaticMeshComponent (and UHierarchicalInstancedStaticMeshComponent) support moveable instances, or are they only used for instancing static/stationary objects?
I’ve investigated further and realized that UInstancedStaticMeshComponent has an interface that takes current and previous transforms when batch updating instances, so I switched to using this, but unfortunately it made no difference.
I’m going down a rabbit hole debugging UInstancedStaticMeshComponent and it seems like it must be an internal bug, as far as I can see the previous transforms are being passed down correctly, so it should be calculating correct motion vectors but I still don’t see any when visualizing motion blur.
If anyone has encountered this and found a solution I’d love to hear about it.
OK, I solved it. I was still using the wrong interface, I think. Using the function UInstancedStaticMeshComponent::UpdateInstances that takes instance IDs as well as transforms and previous transforms works for me. I was previously using BatchUpdateInstancesTransforms which did not take instance IDs.