How do I setup and use TextureRenderTarget to create HUD?

Hi all,

Recently I just started to work on UE4 and tried to figure out a simple way to rapid prototype HUD so that artists can easily drag and move UI items around, instead of setting values in blueprints. In Unity it is pretty easy to setup a camera far away from the whole scene and render both this camera and the main camera.

In UE4, I had learnt that I can use TextureRenderTarget, SceneCapture2D and DrawTexture in AHUD to draw the rendered texture on the screen. However, the main issue is that the render texture will always include the background color.

Is there anyway to make sure the alpha value of the background in this texture is always 0? Like that in Unity?

If the only solution is to modify engine source code, how can I achieve it? Should I investigate into CaptureComponent2D?

Thank you very much!

You could try use material to remove backgroud color

Thank you !

I think this could be a good temporary solution for my case if I set the background/sky color to pitch black.

Still, please share if anyone has a more flexible solution. For instance, is it possible to setup a SceneCapture2D that ignore skybox and always render background as black color?

As far as i know, and the way i’ve been doing it, is exactly that way, you have to add your texture into a Material, remove the background using masked texture and finally rendering the part of the texture you want. If you are capturing a whole scene, its dificult to know or tell to the material witch part to clean. But if u are trying to render a specific Mesh, you can make a diferent room, completly closed, putting the camera and the mesh inside with some lights setup. make sure the background is fully black with a Material with unlit mode so the lights in the scene dont affect it. Doing that u can easily clean the background plugging it in the opacity mask then finally pluging the texture to the emmisive. That should work for you.