GroomComponent: SetVisibility(false) causes per-frame simulation reset instead of stopping it

UGroomComponent::TickComponent sets bResetSimulation = true every frame when !IsVisible(), causing NiagaraDataInterfaceHairStrands to trigger a full simulation reset via ForceReset each tick. This results in higher GPU cost than when the component is visible.

Key Code:

void UGroomComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
//Some Code
		bResetSimulation |= SimulationSettings.SimulationSetup.bResetSimulation;
		if (!IsVisible() || (GetOwner() && GetOwner()->IsHidden()))
		{
			bResetSimulation = true;
		}
//Some Code
}
 
 
bool UNiagaraDataInterfaceHairStrands::PerInstanceTick(void* PerInstanceData, FNiagaraSystemInstance* SystemInstance, float InDeltaSeconds)
{
	FNDIHairStrandsData* InstanceData = static_cast<FNDIHairStrandsData*>(PerInstanceData);
 
	FNDIHairStrandsInfo InfoData;
	ExtractDatasAndResources(SystemInstance, InfoData);
 
	if (SourceComponent != nullptr)
	{
		InstanceData->ForceReset = SourceComponent->bResetSimulation || RequiresSimulationReset(SystemInstance, InstanceData->SkeletalMeshes);
		if (InstanceData->ForceReset)
		{
			FNDIHairStrandsBuffer* LocalStrandsBuffer = InstanceData->HairStrandsBuffer;
			ENQUEUE_RENDER_COMMAND(FNiagaraDIDestroyInstanceData) (
				[LocalStrandsBuffer](FRHICommandListImmediate& CmdList)
				{
					if(LocalStrandsBuffer)
					{
						LocalStrandsBuffer->bShouldReset = true;
					}
				}
			);
		}
	}
	InstanceData->Update(this, InfoData, InDeltaSeconds);
	return false;
}

重现步骤

  1. Drag a Groom asset into the viewport to spawn a GroomActor. The asset must have physics simulation enabled (Solver Settings → Enable Simulation) in at least one group.
  2. Click Play (PIE).
  3. Select the GroomActor spawned in Step 1, and uncheck Visible in the Details panel.
  4. The hair simulation resets every frame instead of being suspended.

你好

我已经针对这个问题提交了错误报告:

https://issues.unrealengine.com/issue/UE-369714

后续会有相应开发人员调查这个问题。我们不会在 EPS 上提供更新。但您可以在上面的问题跟踪页面上查看进度。我现在将关闭这个案例,但如果您有任何后续问题,请随时与我联系。

谢谢

Henry Liu

感谢回复