How can I render the game to a portion of the screen?

Issue

I’d like to be able to specify a region of the screen to use as the drawable area. I currently have a scene in game and a UMG widget I can toggle on and off acting as a sidebar.

When the sidebar is visible, I’d like to resize the render region to compensate for the screen space the sidebar occupies to keep the scene centered in the visible area.

Attempted Solutions

I’ve tried to offset the camera to “re-center” the scene to compensate for the sidebar, but manipulating the perspective camera makes interaction feel more incorrect than having a portion hidden, since the user expects the camera to be capturing from the center of the visible area.

I’ve tried capturing the scene using a scene capture camera, but faking the view that way makes input a pain. Additionally, I feel fairly confident that the correct solution doesn’t involve rendering the whole scene twice then obscuring one of those scenes with a fixed-resolution render of said obscured scene.

I’ve looked into doing something silly with splitscreen layouts, but realized that it was silly and there is probably a more correct way to achieve this.

Example

Current Screen

Here’s what’s currently happening when I display the sidebar. Notice how the snowmobile is technically centered on the screen, but is effectively partially offscreen, hidden behind the sidebar widget.

Desired Screen

Here’s an example of what I’d like the scene to look like when I display the sidebar. Notice how the scene is centered in the area not occupied by the sidebar. The game knows it can only render to a specific region, so the camera compensates for it (similar to changing screen resolution).

Desired Screen (HUD Hidden)

Finally, here’s what I assume it would look like with the render region resized without displaying the sidebar. This image is to show that I’m not wanting to shift the camera, but instead to render the exact same scene on only a portion of the screen.

1 Like

Were you ever able to find a solution to this? It would be helpful for a project I’m building and I can’t find any information elsewhere.

Unfortunately, I wasn’t able to find any way to change the render size and position on the screen. My solution involved using the screen size, distance from the camera and field of view to manually offset the camera to meet my needs.

I asked separately and as a result there is a pending feature request. Vote for it and hopefully it becomes a reality.

It’s sad that no one know a way. I’d really love to know how :confused:

2 options

  1. Viewport widget in UMG or Slate, never used it yet so you need to test out it works, use Slate if you need to it gives more options and as i remeber they added viewport widget as experimental in UMG. This might take some proformance or else you manipulate main viewport settings which probably requires C++
  2. Use Post Processing material, make centered UV map (it should take simple math) only to portion of the screen and make text aperr on empty space

Moving camera is also good option :slight_smile: it does not matter how you do it as long it is not resource heavy and slick, the final effect is most importent

Is it possible to do this in version 5?

In Unity3D, such things are very easy to do through clipping planes and viewport rect.

I’m surprised that unreal can’t handle such simple things. And apparently this will not be possible at all because of the more primitive architecture of the engine than Unity3D. :frowning:

Any Solution?

Hi, i had a need to do this for some of my apps.
I added the solution as part of a plugin called EnhancedUi. Which is mainly tools to build “Editor Like” UI/Ux at runtime.

In short you can use the UMG Splitter(from plugin too) and the Viewport Window…
Ive also given a more detailed answer here : Split viewport into areas of different contents

The guide : UE5 Separate Viewport From Widgets: EnhancedUI – Enhanced UI Plugin

The pluign on fab: https://www.fab.com/listings/b8777f94-8b76-4af9-a110-3c6329b31d06

Free Shipped/Packaged game to test: Unreal Musician on Steam