Idk what the deal is. If you set the clear color to straight alpha 0, the whole image won’t render. Ever. Even you render something with full alpha on top of it.
But in case it helps someone in the future. I just made a custom rendertarget function that allows you to set some additional parameters.
#include "Engine/CanvasRenderTarget2D.h"
UFUNCTION(BlueprintCallable, Category = "Canvas Render Target 2D", meta = (WorldContext = "WorldContextObject"))
static UCanvasRenderTarget2D* CreateCustomCanvasRenderTarget2D(UObject* WorldContextObject, TSubclassOf<UCanvasRenderTarget2D> CanvasRenderTarget2DClass, int32 Width = 1024, int32 Height = 1024, FLinearColor clearColor = FLinearColor(0,0,0,1), EPixelFormat pixelFormat = EPixelFormat::PF_A16B16G16R16, bool forceGamma = false);
cpp
UCanvasRenderTarget2D* UGameUtilities::CreateCustomCanvasRenderTarget2D(UObject* WorldContextObject, TSubclassOf<UCanvasRenderTarget2D> CanvasRenderTarget2DClass, int32 Width, int32 Height, FLinearColor clearColor, EPixelFormat pixelFormat, bool forceGamma)
{
if ((Width > 0) && (Height > 0) && (CanvasRenderTarget2DClass != NULL))
{
UCanvasRenderTarget2D* NewCanvasRenderTarget = UCanvasRenderTarget2D::CreateCanvasRenderTarget2D(WorldContextObject, CanvasRenderTarget2DClass, Width, Height);
if (NewCanvasRenderTarget)
{
NewCanvasRenderTarget->ClearColor = clearColor;
NewCanvasRenderTarget->InitCustomFormat(Width, Height, pixelFormat, forceGamma);
return NewCanvasRenderTarget;
}
}
return nullptr;
}
good luck to everyone. I’m content with a .5 alpha on my particular project, but I don’t feel like digging anymore into source to find out why alpha clear of 0 just negates all future renders
EDIT: I’m actually wondering if the Canvas is the bigger problem with the clear. I’m not sure. It gets a little too advanced for me at those depths and I don’t have the patience to navigate them right now
EDIT2: Setting my decal to AlphaComposite allowed me to clear to transparent black without the following calls also being disregarded. However, I am still unable to render something black (full alpha) on top of it without it being discarded. Maybe someone more patient than me can figure out the right set of settings.