Rendering with transparency in Unreal Engine

- by

Like everything in Unreal Engine, rendering a subject with a transparent background isn’t a one-click affair. It’s doable though, thanks to a neat tip by Alexzander The Geek on YouTube. In the above screenshot, the background was added in Photoshop, exactly how I like it! Here’s how to do it in principle:

  • enable transparency in your Project Settings
  • set all elements you don’t want in your render to “hidden in game”
  • render as PNG or EXR

Let’s take a look at this step-by-step with screenshots.

Enabling Transparency in your Project

Head over to Edit – Project Settings and search for Alpha. Change the setting under Engine – Rendering- Postprocessing from its default “Disabled” to “Allow through Tonemapper”.

Note that this will require an engine restart and a re-compilation of all shaders in your project. A restart is usually quick, but adding transparency takes quite a bit longer. Time to grab a coffee.

Hiding unwanted Actors

Select the objects you’d like to hide in your project, anything that would normally be drawn out in the background (sky, walls, etc). Don’t hide your lights, otherwise they won’t contribute to your overall lighting composition. Search for “hidden” in the details panel and enable Actor Hidden In Game for everything you want to remove.

Rendering with Transparency

By default Unreal Engine will render a JPG image sequence, but that doesn’t support transparency. Change it to either PNG or EXR in the Movie Render Queue (the legacy Movie Capture doesn’t seem to render transparency). I’ve had issues during testing, which seems to have been alleviated by saving all files before starting a new render. Could be a bug with Movie Render Queue, I remember the legacy option prompting us to save before a render could even begin.

Major Caveat Alert: Rendering with transparency only works with a single sample. If you override Anti Aliasing with a higher sample count (spatial or temporal), transparency is not rendered as of Unreal Engine 4.27.2. Let’s hope this is implemented in a future update.

As a workaround, render an image with a single sample to get transparency and use it as a mask, then render again with a higher sample count, or oversample the image size to get a similar effect with built-in transparency.

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

Add your voice