UE 5.1 SceneColor in SceneCapture2D not capturing opacity

This is only an issue in 5.1 other version works as expected, I’m trying to capture an image of an object with a transparent background.
I’m using SceneColor (HDR) in RGB, InvOpacity in A

In the material I do this, the result here is nothing displayed

If I plug Alpha directly

I get a black background which explains why I get nothing in the first example because alpha is always 1

In other versions it’s working as intended but in UE5.1 I get a solid black color instead.
The image below is how it should be, this is in 4.27

Any help would be appreciated it, thank you.

1 Like

Hi there,

We also ran into this exact issue, except we are going from UE 5.0.3 to 5.1, so it seems this issue was introduced in 5.1. If rendering preview level is off, everything looks fine in the editor. But once we turn on the rendering preview or package to our targets (we target Android and iOS) this issue manifests itself.

In the 5.1 release notes https://docs.unrealengine.com/5.1/en-US/unreal-engine-5.1-release-notes/ , there’s a bit saying:
Scene Capture render targets now start with the alpha channel disabled

Not sure what that means and if it’s related to this issue. We’ve fiddled with many settings to see if we can “enable” alpha again, but to no avail.

1 Like

This is happening to me too. Made a new project to test and it appears that the scene capture is not rendering out an alpha with Vulkan, Metal or ES3_1.

1 Like

Another clue:

  • I’ve tried disabling Mobile HDR, and the transparency is captured again, but the captured textures’ colours are all washed out.

We most likely don’t want to disable mobile HDR, but hopefully another clue to what’s going on.

For now I’m using this post process inside the post process settings of the scene capture 2D to get the opacity to work, this also works in final color mode.


I’m still curious about what changed and how to make it work like before but at least this is another way to solve it.

2 Likes

Hi @KaidoomDev,

I’ve tried your workaround and still not working for us - the texture still does not have alpha (i.e., no checkerboard, only black). Out of curiosity, what is your target platform?

Here’s a quick small project with it working.
SceneCap.zip (40.4 KB)

Let me if you have any questions.

1 Like

@KaidoomDev - Thanks for the project.

Your project works with alpha (as does ours), ONLY if no rendering preview is enabled. When setting the rendering preview to any mobile platform and deploying to device, the transparency isn’t there, so, I think there’s there’s probably an issue with the scene depth capture in Unreal.

I did/could not try with the D3D Shader previews - I’m on a Mac, and if I switch to those previews, Unreal crashes :man_shrugging:

Android Vulkan/IOS SM3_1:

Preview Rendering Level disabled:

Yeah it seems like the opacity of that post process is not taken into consideration at all in mobile. Hopefully someone can clarify if this is an issue with the engine or there’s some other way.

So in my case I found a clue, I have effects set to medium in scalability settings, if I set it to epic it works as expected.

Edit: Found the cvar, it’s r.SceneColorFormat in epic scalibility it’s set to 4

1 Like

I’ve been running into this issue as well and think I’ve found out what’s wrong.

Looking in: Engine\Source\Runtime\Engine\Private\SceneTexturesConfig.cpp line 233

In FSceneTexturesConfig::InitGetSceneColorFormat it picks a scene format based on r.SceneColorFormat - scene format 4 includes alpha but 2&3 do not - but if the view requires Alpha, overrides with RGBA (scene format 4).

The problem is that FSceneTexturesConfig::Init never copies over bRequiresAlphaChannel from the input settings, so this check fails because it never thinks it actually needs alpha.

I’ve seemingly fixed this locally by adding the following above the call to BuildSceneColorAndDepthFlags() in FSceneTexturesConfig::Init:

	bRequiresAlphaChannel = InitSettings.bRequiresAlphaChannel;

Scene capture now renders as expected no matter what my r.SceneColorFormat is set to

edit: Looks like a fix for this is already submitted in ue5-main (https://github.com/EpicGames/UnrealEngine/commit/c17ed2eeb2d2ea957bdd6b65af9de57ba6754490), hopefully it makes it into a 5.1 hotfix

6 Likes

@essbuh Thanks for your post! I’ve cherry picked the fix to our 5.1 fork and it solved our problems. Amazing that you managed to track this down - thank you!!

I’ve had an issue with a night vision material on widget Camera “Plane” and in New 5.1.0 was not working at all and this setting “output Alpha” nailed it!. Thanks. (just to clarify with this setting un-ticked in 5.0.3 and previous versions it worked fine):

Before NightVision is Set to ON


After NightVision is Set to ON with no Output Alpha ON


After NightVision is Set to ON with Output Alpha ON

2 Likes

Thank you, bro! This work with my project! :blue_heart:

1 Like

This technique only works correctly on the Blueprint in the Content Drawer, but it doesn’t work if the object is staged. In presence of another post processing for the scene with another post process material, the background remains black. :expressionless:

There are no Layers in Unreal?
Having worked for years with Unity, this is done easily through Layers.
Unreal is really behind in this one.

Biiig! Thank you, it was that cvar preventing my Post Process to output alpha.

1 Like

How to find cvar?,I call “Get Game User settings”,and can’t find “cvar”.

2024 and this is still the fix. Thanks my dude!