Gpu particles perfomance

I ran into this problem when the camera is very close to the Particle Emitter FPS falls somewhere with very stable 60 to 15.
the effect is a …

material for effect

material parameter distance set from code only once if dist value changed

TArray<FString> Instances;
	UMaterialInstanceDynamic* MI = nullptr;
	Instances.Empty();
	FString Path = "MaterialInstanceConstant'/Game/BillBoards/fogMaterial_Inst.fogMaterial_Inst'";
	MI = (UMaterialInstanceDynamic*)LoadObject<UMaterialInstance>(NULL, *Path);
	if (MI)
	{
		MI->Modify();
		MI->SetScalarParameterValue("distance", dist);
	}

Is this your tick function? If it is, then this looks really bogus.

You are loading a material instance every tick, which is already as slow as it gets. However you are also using the UMaterialInstance as UMaterialInstanceDynamic which is not correct. Try the CastChecked() instead of a plain c-style cast to make sure you can safely cast between the two types. So basically you are modifying the source asset (MaterialInstance) and not a dynamic instance of that material.

Instead you should create a dynamic material instance during initialization (e.g. BeginPlay), keep the pointer to it and then only set the distance parameter within your tick function.

Marc

partly yes, this function is called in the game 1 - 2 times.