Set aspect ratio for splitscreen

Hello, I’m trying to implant splitscreen in my game but I want to keep my viewport’s aspect ratio. Right now when I enable 2 player splitscreen on a 16:9 screen both viewports will become 32:9 like this:

http://puu.sh/mHKD5/5f60aad96a.jpg

What I want is both viewports keep their 16:9 ratio like this

I’ve tried forcing the screen ratio but what happens is both viewports size up to full screen and overlap eachother.

Any ideas how to fix this?

Hey Mootjuh,

This is actually a pretty simple fix. Just open up the player blueprint associated with the player you are spawning and click on the camera actor component. Then select the ‘Constrain Aspect Ratio’ checkbox and select your desire aspect ratio.

Player Blueprint - Camera Settings

Multiplayer - Constrain Aspect Ratio

Let me know if you have further questions or need additional assistance.

Cheers,

1 Like

Wouldn’t that force that same ratio on all screens? Meaning it would force say a 16:9 aspect ratio on a 4:3 screen even if the player is playing alone?

Well you could expose this as an option for your game. You cannot have both, but isn’t that what you were requesting in your initial post, to run in aspect ratio for the entire screen when in multiplayer?

My concern is not everyone is supposed to have 1.7777778 as their aspect ratio because of different screen sizes. But if this can be changed depending on the client’s screen size, then it should be no problem. Although last time I tried manually setting the aspect ratio both viewports scaled to full screen.

It can be changed, it just needs to be handled through adding some custom logic to blueprints. Usually though, this is an option either within the settings menu of a game, or the within the television itself.

Well essentially the game would determine the ratio by checking the viewport size and then setting the character’s aspect ratio accordingly. At least that’s how I imagine it should go.

In the 2nd screenshot, it’s not 16:9 ratio, it’s more like 21:9. The thing that make 2 screenshots different is that in the your game, the HORIZTONAL fov is kept the same when the screen is splitted, but in 2nd screenshot the VERTICAL fov is kept the same. So what you want to do is to make UE4 keep its vertical fov the same during splitscreen or normal screen. However unreal camera’s fov is for horizontal fov, so to keep vertical fov the same you need to do this conversion at run time:
In player controller begin play, save the original horizontal fov value: something like this
m_originalHorizontalFOV = GetCamera()->GetCameraComponent->FOV; // Pseudo code

In the tick you do this

if (ULocalPlayer *localPlayer = GetLocalPlayer())
{
   int x, y;
   GetViewportSize(x, y);
   FVector2D playerViewSize(localPlayer->Size.X * (float)x, localPlayer->Size.Y * (float)y);

   GetCamera()->GetCameraComponent->FOV->FieldOfView = FMath::RadiansToDegrees(2 * FMath::Atan(FMath::Tan(FMath::DegreesToRadians(m_originalHorizontalFOV ) / 2) * playerViewSize.X / playerViewSize.Y));

}