Download

Rendering In-Game UI to a Separate Render Target?

I’ve been iterating on solutions for rendering in-game UI that interacts well with our world (e.g. handles occlusion with other in-game objects gracefully). What I’d like to do is have certain meshes tagged to render only on the UI layer. These would use the same camera settings as the main camera but would only render to a separate render target. I’d then blend them in to the main scene using a post-process pass.

I’ve done systems exactly like this in Unity where you can set a layer on each object and then a layer mask on each camera to control what it renders. I’m looking for a similar workflow in UE4. I’d really prefer if the in-game UI lives in the same scene space as the rest of the game but is just tagged to only render on the second camera.

Currently the solution I have uses the Custom Depth and Stencil Buffers. The result is pretty close to what I want but has some significant limitations: the total number of colors I can use is limited by the stencil buffer depth, I can only set one color per mesh, the results are more aliased than I’d like (or tear like crazy if I render them before TAA) and the workflow is pretty awful to the extent that non-engineers can’t really create UI.