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

ZacharyLewis
Wed, 06 Apr 2016 21:59:14 +0000
Rendering

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.

10 posts - 8 participants