Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.14
more ▼

asked Jan 10 '17 at 06:36 PM in Rendering

avatar image

157 17 19 35

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

more ▼

answered Jan 10 '17 at 08:11 PM

avatar image

2.1k 67 84 77

avatar image saldavonschwartz Jan 10 '17 at 08:59 PM

@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++).

avatar image CleanCut Jan 11 '17 at 12:33 AM

Maybe they renamed ClearColor to ChromaKeyColor in blueprints?

alt text

avatar image RHoath Mar 02 '17 at 03:34 PM

ChromaKeyColor is a separate property.

You could try exposing FLinearColor ClearColor in TextureRenderTarget2D.h?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can use "Clear Render Target 2D" in blueprint: https://puu.sh/us8HR/c2732b52e0.jpg I'm using this to fix blackness on StereoLayer when rendering a 2D UMG .

more ▼

answered Mar 03 '17 at 09:27 AM

avatar image

38 1 4 7

avatar image Jonas_Molgaard Aug 31 '17 at 08:08 AM

@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.


avatar image Jonas_Molgaard Aug 31 '17 at 08:24 AM

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

capture.png (391.3 kB)
avatar image S-ed Aug 20 '18 at 11:11 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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);

more ▼

answered Jan 02 '18 at 09:59 AM

avatar image

61 4 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question