Transparency in Render Target 2D shows up black


I’m trying to render a 3d widget onto a 2d texture, using a render target 2d asset created from within the editor and the FWidgetRenderer class at runtime, from within C++. But any transparency in the widget shows up as black in the resulting texture (I’m using this in the context of stereo layers for VR).

Is there anything I need to do to enable transparency when rendering or displaying the rendered texture?


I just did some tests and it seams the deal is that I cannot set the clear color of the texture to “Transparent” from within the editor. That is, if in C++ I grab a reference to the texture I created in the editor and at runtime do Texture->ClearColor = FLinearColor::Transparent; then from that point onwards transparency does work.

So I guess the question is how does one set the clear color of a render target texture from within the editor?

According to the 4.14 release notes:

The “SceneColor (HDR) in RGB, Inv Opacity in A” option can be used to render objects with translucency into a texture which can then be alpha-blended over a scene or widget blueprint.

Not sure if that’s any help. It’s under the “New: Scene Capture Improvements on Mobile” section of the release notes for 4.14.

@CleanCut Thanks for the info. I’ll check it out. However, I updated my question since it looks like it’s about the texture’s clear color; I don’t know how to set it to transparent from within the editor (I only know how to from C++).

Maybe they renamed ClearColor to ChromaKeyColor in blueprints?


ChromaKeyColor is a separate property.

You could try exposing FLinearColor ClearColor in TextureRenderTarget2D.h?

You can use “Clear Render Target 2D” in blueprint:
I’m using this to fix blackness on StereoLayer when rendering a 2D UMG .

@DeathUman the picture you posted is missing. Can you repost your solution by chance? I got the same problem with blackness on my StereoLayer using a color (0,0,0,1) if i call clear with (0,0,0,0) then all subsequent draws are not showing up, even with a material that has an alpha map.


This is my setup btw… it works in PIE, but once i package it, it turns black. Im on 4.17 btw.

This works for me

	Instructions_RT = NewObject<UCanvasRenderTarget2D>(this);
	Instructions_RT->InitAutoFormat(ViewSize.X / 2, ViewSize.Y);
	Instructions_RT->ClearColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.0f);

@DeathUman This is the reason why I hate people linking images for 3rd party sites. -_-

@DenisDubinin Can you expand on this. My Stereo Layer can’t show transparent when I have Support Depth on, the transparent parts just show up as black. But it works fine when it’s off.
I’ve tried all sorts of ways to change my clear colour, BP and C++ but neither seems to work. Could you please expand on what you did?

I’ve seen your update and you say you’ve got it working?
My stereo Layer shows as black in the (whats supposed to be) transparent parts only while I’ve got Support Depth on.
I did what you said and got a reference to the Texture (I assume you meant render target of the Widget?) and set the ClearColor but that didn’t seem to help.
Can you give any other context for how you fixed it? I’ve been trying to fix this for about 10 hours now and I’m losing my mind.