Can you always render occluded Paper2D sprite?


I just stumble into this too, for anyone still looking for a solution. it seems to be quit easy, just copy “!ShouldRenderCustomDepth()” from FStaticMeshSceneProxy to FPaperRenderSceneProxy if you’re building from source. As precompiled engine, there seems no easy(standard) way to fix it. I just use code below to hack it and it worked. btw, my engine version is 5.6.

// it seems Paper2D lacks support and lost some features later on. see FPaperRenderSceneProxy::CanBeOccluded() and FStaticMeshSceneProxy::CanBeOccluded()
// here we use material relevance to disable occlusion while using custom depth
FMaterialRelevance UDerivedFlipbookComponent::GetMaterialRelevance(ERHIFeatureLevel::Type InFeatureLevel) const
{
	FMaterialRelevance MR = Super::GetMaterialRelevance(InFeatureLevel);
	if (bRenderCustomDepth)
	{
		MR.bDisableDepthTest = true;
	}
	return MR;
}