Using UCanvasRenderTarget2D to merge Texture2D but the color is not correct.

Hi guys! I want to merge a lot of picture which with alpha.However, the effect looks inconsistent.

This is screen shot.
image



陈致远
iOSResource_IOS_001_P.pak
77.7 MB
传输完成
VRRenquan.ipa
360.3 MB
传输完成
VRRenquan.ipa
287.8 MB
传输完成
svn://124.71.186.143/FreatAssets-360/360-render-app-pak-20220929
VRRenquan.ipa
290.7 MB
传输完成
VRRenquan.ipa
288.8 MB
传输完成
svn://124.71.186.143/FreatAssets-360/360-render-app-pak-20220929
UCompositeTexture::UCompositeTexture()
{
	OnCanvasRenderTargetUpdate.AddDynamic(this, &UCompositeTexture::PerformMerge);
}

void UCompositeTexture::PerformMerge(UCanvas* Canvas, int32 Width, int32 Height)
{
	for (int32 i = 0; i < Layers.Num(); ++i)
	{
		UTexture2D* LayerTex = Layers[i];
		if (LayerTex)
		{
			FColor TintColor = FColor::White;
			if (LayerTints.Num() > i)
			{
				TintColor = LayerTints[i];
			}
			Canvas->SetDrawColor(TintColor);
			Canvas->DrawTile(LayerTex, 0, 0, Width, Height, 0, 0, Width, Height, BLEND_Masked);
		}
	}
}

UCompositeTexture* UCompositeTexture::Create(UObject* WorldContextObject, const TArray<UTexture2D*>& Layers)
{
	TArray<FColor> Colors;
	return UCompositeTexture::Create(WorldContextObject, Layers, Colors);
}

UCompositeTexture* UCompositeTexture::Create(UObject* WorldContextObject, const TArray<UTexture2D*>& Layers, const TArray<FColor>& LayerTints)
{
	if (Layers.Num() <= 0)
	{
		return NULL;
	}

	UTexture2D* BaseTexture = Layers[0];

	UCompositeTexture* RenderTarget = Cast<UCompositeTexture>(UCanvasRenderTarget2D::CreateCanvasRenderTarget2D(WorldContextObject, UCompositeTexture::StaticClass(), BaseTexture->GetSizeX(), BaseTexture->GetSizeY()));
	RenderTarget->CompressionSettings = TC_VectorDisplacementmap;
	RenderTarget->SRGB = false;
	RenderTarget->Layers.Append(Layers);
	RenderTarget->LayerTints.Append(LayerTints);

	RenderTarget->UpdateResource();
	return RenderTarget;
}