Jump to content
Sign in to follow this  
Matthias1231

Multi-Monitor Distortion Workaround Shader

Recommended Posts

I've been experimenting with a workaround for the lack of multi-view for multi-monitor setups and reducing the distortion on the side screens.
I figured I could write a ReShade shader that squeezes the outside screens while leaving the center one unchanged.

I haven't had time to really test this much yet, but I wanted to share my efforts so far and see if that is of any benefit to any other multi-monitor simmers.

This requires Reshade installed for MSFS. Just save the shader code to a file called MultiMonitor.fx and copy it to your ReShade shader folder for MSFS and enable it in the Reshade menu. 
It only works with 3 monitors of the same size and resolution. You can either run in surround mode or drag the MSFS window to cover all 3 screens.

Yes, I know, some of the screen space is wasted, you can't click on anything in the outside views, performance impact, blah blah blah. 

The math still needs work but you can squeeze the side view with the Factor value and distort it with the Power value.

When I have more time I will revisit the math and also add bezel correction.

y4mbdfVUW61UmbQUZ91KUHQgjjoUf1XLNoMrp4ir

3 monitor setup distortion

y4mY2aMcg7YGf4o_FSAd_vZ2FPeoKckoMC0pNSLt

Shader squeezing outside views with default settings

ReShade shader Code:

#include "ReShadeUI.fxh"

uniform float factor < __UNIFORM_SLIDER_FLOAT1
	ui_min = 0.0; ui_max = 5;
	ui_tooltip = "Factor";
> = 1;

uniform float power < __UNIFORM_SLIDER_FLOAT1
	ui_min = 1; ui_max = 10;
ui_tooltip = "Power";
> = 2.5;

#include "ReShade.fxh"

float3 MultiMonitorPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float3 color;
	float2 sourceCoord;

	float texTimes3 = texcoord.x * 3.0;
	float monitorPos = texTimes3 - 1.0;
	float monitorIx = floor(monitorPos);

	float texTimes3Centered = texTimes3 - 1.5;
	float absTex3 = abs(texTimes3Centered) - 0.5;
	if (absTex3 > 0 && absTex3 < 1) absTex3 = pow(absTex3, power);
	float centerOffs = absTex3 * monitorIx;
	float finalOffs = centerOffs * factor;
	float sourceX = texcoord.x + finalOffs;

	sourceCoord.x = sourceX;
	sourceCoord.y = texcoord.y;

	color = (sourceX < 0 || sourceX > 1) ? 0 : tex2D(ReShade::BackBuffer, sourceCoord).rgb;
	return color;
}

technique MultiMonitor
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = MultiMonitorPass;
	}
}

 

  • Like 1

Matthias - KCOS
         Sim: P3D 4.5, UTX V2, ORBX Base openLC NA EU, ASP3D, TOGA, RealityXP, SPAD.neXt, Carenado GA
          PC: i9-11900k, RTX 3090, Asus Rog Strix Z590-E
Home Cockpit: Honeycomb AFC, Thrustmaster T.Flight, RealSimGear GNS530, Logitech FIP FMP FRP FSP FTQ*2, 3x55" 4K TVs (View), 26" 21:9 (Gauges)

Share this post


Link to post
Share on other sites
2 hours ago, Matthias1231 said:

I've been experimenting with a workaround for the lack of multi-view for multi-monitor setups and reducing the distortion on the side screens.
I figured I could write a ReShade shader that squeezes the outside screens while leaving the center one unchanged.

I haven't had time to really test this much yet, but I wanted to share my efforts so far and see if that is of any benefit to any other multi-monitor simmers.

This requires Reshade installed for MSFS. Just save the shader code to a file called MultiMonitor.fx and copy it to your ReShade shader folder for MSFS and enable it in the Reshade menu. 
It only works with 3 monitors of the same size and resolution. You can either run in surround mode or drag the MSFS window to cover all 3 screens.

Yes, I know, some of the screen space is wasted, you can't click on anything in the outside views, performance impact, blah blah blah. 

The math still needs work but you can squeeze the side view with the Factor value and distort it with the Power value.

When I have more time I will revisit the math and also add bezel correction.

y4mbdfVUW61UmbQUZ91KUHQgjjoUf1XLNoMrp4ir

3 monitor setup distortion

y4mY2aMcg7YGf4o_FSAd_vZ2FPeoKckoMC0pNSLt

 

I applaud the effort but surely this just gives the same result as using a narrower window and adjusting the zoom to achieve the same vertical FoV? To me this would only make sense if you ran a custom screen resolution at a wider-than-actual screen width and your tweak squashed it down to the actual screen width.

Edited by MarkDH

MarkH

gGzCVFp.jpg
Core i7-7700K / 32Gb DDR4 / Gigabyte GTX1070 / 1080p x 3 x weird / Win7 64 Pro

Share this post


Link to post
Share on other sites

It's not the same as an FOV change. The default projection using three monitors is based on the monitors being aligned on a flat surface. This shader results in a partial (fake) projection adjustment compensating for the angle at which the outside screens are turned towards the user.


Matthias - KCOS
         Sim: P3D 4.5, UTX V2, ORBX Base openLC NA EU, ASP3D, TOGA, RealityXP, SPAD.neXt, Carenado GA
          PC: i9-11900k, RTX 3090, Asus Rog Strix Z590-E
Home Cockpit: Honeycomb AFC, Thrustmaster T.Flight, RealSimGear GNS530, Logitech FIP FMP FRP FSP FTQ*2, 3x55" 4K TVs (View), 26" 21:9 (Gauges)

Share this post


Link to post
Share on other sites
19 minutes ago, Matthias1231 said:

It's not the same as an FOV change. The default projection using three monitors is based on the monitors being aligned on a flat surface. This shader results in a partial (fake) projection adjustment compensating for the angle at which the outside screens are turned towards the user.

I maintain (at least on first glance) that you will get the same effect by running a narrower window and adjusting the zoom. The required zoom setting will be larger (longer effective focal length) and hence the distortion away from the centre of the image will be less extreme. I have yet to install MSFS but by all accounts it seems to behave pretty much exactly like FSX and P3D.


MarkH

gGzCVFp.jpg
Core i7-7700K / 32Gb DDR4 / Gigabyte GTX1070 / 1080p x 3 x weird / Win7 64 Pro

Share this post


Link to post
Share on other sites

You keep maintaining then. Thanks for participating.

 


Matthias - KCOS
         Sim: P3D 4.5, UTX V2, ORBX Base openLC NA EU, ASP3D, TOGA, RealityXP, SPAD.neXt, Carenado GA
          PC: i9-11900k, RTX 3090, Asus Rog Strix Z590-E
Home Cockpit: Honeycomb AFC, Thrustmaster T.Flight, RealSimGear GNS530, Logitech FIP FMP FRP FSP FTQ*2, 3x55" 4K TVs (View), 26" 21:9 (Gauges)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...