I’m looking for a way to offset the view. I’ve set up a camera with a specific aspect ratio like this:
I want to offset this view to the side, to allow for UI elements next to it. So it looks like this:
NOTE: This is for in-game use and not an attempt to move the viewport in editor.
Is this possible?
Any help is appreciated!
You could do by post processing material, which is a material (which is technically shader) applied to entire screen and you can sample screen like a texture with uv map:
So all you need to do is subtract x value of screen UV to shift it ot the left and clip the screen by making anything on UV map outside of 0 to 1 range to black (or whatever color you want).
Now since UV map is between 0 and 1 this shift most likely will mess up in different aspect ratios that monitor can have, you will need to put viewport size (there node to get that) in to account, simply divide number of pixels you gonna shift screen by the size of view port in X axis.
You can control the shift using material parameters and timeline to animate it:
Issue is it’s kind of messy to make material dynamic instance in post process in blueprints in order to control those parameters, but you could clean it up with macros.
Maybe you didn’t want this, this will work fine in editor too ;] You can also add other effects on to of it, with post process material you can alter screen pixels whatever you want.
If you use a material to render to, then I wonder if it would be easiest to simply place that material on a UMG widget to make it easy to size and lay out? I never tried that. Just an idea.
Resurrecting this thread because I’m trying to achieve the same thing. @AquaRex did you have any luck? @Shadowriver, the problem with this approach is that it squishes the entire game view, so everything renders horizontally squished. Changing the camera’s aspect ratio doesn’t help, as it always adds black bars, and you can’t shift the view left or right, it stays centered with the black bars at equal sizes on the left/right or top/bottom.