Scene Capture 2D transparent background

Hi all,

I am trying to have a mesh displayed inside of my UMG widget, rendered as it currently looks like in the game.
So far, I was able to set up Scene Capturing for a character:

280435-full-render.png

The next step would be to only enable the charactor actor to be captured, with transparent or self-defined background like the house mesh in the following image (image stolen from [this question][2]):

Using “Show Only Actor Components” for the Scene, nothing should be rendered except for my actor. However, some kind of standard background seems to be set. It seems to me as if the landscape and sky box are somehow rendered even though in a very blurry, untextured way. Is there any way to render this to fully transparent?

Since the character is moving, I don’t think masking / chroma keying in the material can do the trick in the current state.

280436-tmp-untransparent.png

1 Like

This might Help

The same issue still appears when adding it directly to the array. I also tried to assign the component directly and clear everything I found clearable but was not able to fix it (The last boolean was set for testing, no difference in having it active or inactive):

320943-unknown.png

I came upon this issue in my own project, and this was my solution.

First, the “standard background” here can be hidden by disabling the “Atmosphere” [ShowFlag][2] on your scene capture component. This can be found in the details pane for your scene capture component, hidden under “General Show Flags” in the Advanced section, or in C++ using SceneCaptureComponent->ShowFlags.Atmosphere = 0;

320945-unknown.png

However, this leaves you with a simple black background instead of the atmosphere, which is more reasonable but still not where we want to be. To solve this I created a new material that looks like this,

Note that the leftmost “Texture” node has been converted to a parameter. Finally, in my drawing code, I am creating a dynamic instance of my material, passing the capture component’s texture target to the Texture parameter that I defined, and at last calling DrawMaterial:

UMaterialInstanceDynamic* matInst = UMaterialInstanceDynamic::Create(MyCustomMaterial, this);
matInst->SetTextureParameterValue("Texture", SceneCaptureComponent->TextureTarget);
DrawMaterial(matInst, 20, 20, 256, 256, 0, 0, 1, 1);

And presto:

320944-unknown2.png

Still needs some cleanup but we’ve done what we wanted!

4 Likes

You, sir, are a genious. Thanks a lot!

I’m struggling to achieve this, searshing everywhere for help, but still nothing, please help me, I’ll show my set-up trying to do this if one of you have some time, please help :"(

Is the render target on first image correct? The area at bottom left are sort of “reflecting” is ta ok? that area is really transparent?

In game the “transparent” area are shown “blank” above the rest of the map.

Not sure what you are trying to achieve. From what I can see, your material is not parametrized. If you want to capture the scene rendering in runtime, you need some kind of input parameter for your material, as the answerer showed. I attached the blueprints from my project below for reference (material graph and setting up my UI image with the scene render).

I will follow your steps and reply as soon as I get home, thak you for the help!!

Man you saved my life, I wasn’t using parameters cause I have 1 material and 1 target render created manually for every scene capture on my level (about 6), not only the transparent background worked but you save me from a lot of working, and everything works fine by now. I’m using that system to make a Portal like game, thank you!!

Can you show me with a video, I do not understand

Thanks you so much, it just worked! But I don’t quite understand, can you explain it in detail?