How to crop the game render to a portion of the application window

I’m not certain the best way to go about this, nor really what my options are. I have a couple candidates, but I’m unsure which is the more likely candidate without understanding the UE4 render pipeline - and how it interacts with Slate specifically - at a deeper level. I’m also unsure if I’ve completely missed other, better, or at least viable, options.


The goal:

Picture a fullscreen application on a widescreen monitor. The application window is vertically segmented into three sections: a centered square, and two equal columns on either side. The central square is the game viewport, the portion that shows the rendered image from the active level camera. The remaining space on either side will be completely covered by the game HUD (slate widgets). The game world will never be visible behind it.


The issue:

How do i do this without rendering the portion of the game world that will be occluded by slate?

I will also be applying post-process effects; some of which will only apply to the game world, and others will apply to the game world and to the HUD. How can I avoid performing post-effects on portions of the game render that will always be occluded by Slate widgets?


Strategy:

I set up my game camera in the player controller, and also use that camera as the viewport to add the slate widgets. When I define the camera, I define the viewport aspect ratio, and have to make it large enough to accommodate the slate widgets. Is there a “clip game render” setting? Should I be adjusting the draw frustum? Is there any way to make my HUD larger than the render space? Can I place Slate widgets outside the game viewport?

At this point I think my best option is to add another camera with a square aspect ratio, render that to a texture, and then draw it directly to the HUD, but then I’m still unsure how to tell the original, widescreen camera not to render anything except the HUD.

So is there a way to have a camera ONLY do the HUD render pass? Do I fake it by artificially occluding the camera? Do I fake it with a very short far-clipping plane? Should I place it in an empty level that exists outside the game world? Do I throw everything at it and see if I notice a performance change?

I’ve found a couple others who’ve asked, but not found any answers. There apparently was a feature request for this at some point, but I’m unclear on what happened with that.

This is a good (older) forum post - but no answers

That forum post links to this issue that was filed, but the link is bad

There’s also this lonely forum post

Obviously this is possible, at least in the sense that the UE4ditor itself is doing this in some fashion. I don’t know if this is done using code that is only existent within the Editor codebase that I can’t use in my game, or if there’s an easy way to do it by utilizing features built into the UE4 engine that I can release with my game. And I don’t know that the way it was achieved for the editor is considered performant or appropriate for a standalone game application.

Does anyone have anything else?

1 Like