Download

Speed tree leaf flicker when HISMC add/remove/update instance

To reproduce this problem, i write a function like this

void UMyBlueprintFunctionLibrary::BeginRandomFoliage()
{

	if (auto IFA = AInstancedFoliageActor::GetInstancedFoliageActorForCurrentLevel(GWorld))
	{
		TMap<UFoliageType*, FFoliageInfo*> FoliageMap = IFA->GetAllInstancesFoliageType();
		for (auto& PerTypeFoliage : FoliageMap)
		{
			UHierarchicalInstancedStaticMeshComponent* HISM = PerTypeFoliage.Value->GetComponent();
			if (HISM->GetInstanceCount() > 0)
			{
				static bool bLeft = false;
				FTransform Transform;
				HISM->GetInstanceTransform(0, Transform);
				Transform.SetLocation(Transform.GetLocation() + FVector(0, bLeft ? 100 : -100, 0));
				HISM->UpdateInstanceTransform(0, Transform, false);
				bLeft ^= true;
			}
		}
	}
}

and call it at the level blueprint


then like this,
2

I update instances[0] transform per 0.1 sec only, but why instances[1…n] is flicker?
but if i spawn a static mesh of this tree(non-instance), it works normally.
3

it is speed tree bug?
I noticed that issue Unreal Engine Issues and Bug Tracker (UE-61559), is it caused by the same reason?
how can i do to avoid to that?

BTW, I profiling the scene using render doc, and find out it seems get trouble at prepass