21:9 Depth issue

  • Ceroes
  • Topic Author
More
5 years 1 month ago #1 by Ceroes 21:9 Depth issue was created by Ceroes
So this has probably been answered before but when play games on my 21:9 that dont support the 21:9 resolution reshade, mxao stretches the screen if you look at the depth buffers they are all too wide and this happens in borderless window and fullscreen. is there any fix?
The issue when in full screen mode.


Seeing the issue

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
5 years 1 month ago #2 by Marty McFly Replied by Marty McFly on topic 21:9 Depth issue
Hmm this is difficult to fix, since in theory, the padding on the outside should not be added by the game itself. And to workaround this, each shader would need to be patched in order for this to work - which wouldn't be a problem if every shader used the ReShade.fxh (which unifies depth access) but shaders like Depth3D don't do that.

To fix most shaders, open the ReShade.fxh and find this function:
float GetLinearizedDepth(float2 texcoord)
	{
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
		texcoord.y = 1.0 - texcoord.y;
#endif
		float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
		const float C = 0.01;
		depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
		depth = 1.0 - depth;
#endif
		const float N = 1.0;
		depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);

		return depth;
	}

Modify so it looks like this
float GetLinearizedDepth(float2 texcoord)
	{
float aspect_fix = 21.0 / 16.0; //adjust source/destination ratio
               texcoord.x = (texcoord.x - 0.5) * aspect_fix + 0.5 ;


#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
		texcoord.y = 1.0 - texcoord.y;
#endif
		float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
		const float C = 0.01;
		depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
		depth = 1.0 - depth;
#endif
		const float N = 1.0;
		depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);

		return depth;
	}

That should work. To fix the qUINT shaders (if you use them), do the same inside the qUINT_common.fxh except I named texcoord uv there.
The following user(s) said Thank You: Ceroes

Please Log in or Create an account to join the conversation.

  • Ceroes
  • Topic Author
More
5 years 1 month ago #3 by Ceroes Replied by Ceroes on topic 21:9 Depth issue
Thanks I will try this out as soon as I'm off work.

Please Log in or Create an account to join the conversation.

  • Ceroes
  • Topic Author
More
5 years 1 month ago - 5 years 1 month ago #4 by Ceroes Replied by Ceroes on topic 21:9 Depth issue
it appears to be stretching the screen stil by about a centimeter.
Normal screen

With the fix and depth enabled for comparison.


What part of the fix could I play with to adjust this?
Last edit: 5 years 1 month ago by Ceroes.

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
5 years 1 month ago #5 by Marty McFly Replied by Marty McFly on topic 21:9 Depth issue
That's expected behavior. Doesn't matter since it's in the black bar area anyways so any AO or such that gets created there isn't visible in the final image anymore. It's only visible when you do some output like this.

Please Log in or Create an account to join the conversation.

  • crosire
More
5 years 1 month ago #6 by crosire Replied by crosire on topic 21:9 Depth issue
What Ceroes means is that the images do not match exactly still. For that adjust the "aspect_fix" value.

Please Log in or Create an account to join the conversation.

  • OtisInf
More
5 years 1 month ago #7 by OtisInf Replied by OtisInf on topic 21:9 Depth issue
try 21.5/16.0. Reasoning: in DMC5 they too use this same system with black bars to fill up the space and 21.5:9 turned out to be the right AR to make it work. I have no explanation, as the client area should be 21:9, not 21.5:9
The following user(s) said Thank You: Ceroes

Please Log in or Create an account to join the conversation.

  • Ceroes
  • Topic Author
More
5 years 1 month ago - 5 years 1 month ago #8 by Ceroes Replied by Ceroes on topic 21:9 Depth issue
The fix for this game is 21.3 / 16 for it to work with Marty McFly mxao and the depth view but it's still messed up for smaa depth edge detection it's has the Original issue it's treating the screen like it was displaying the game in 21:9 still
Last edit: 5 years 1 month ago by Ceroes.

Please Log in or Create an account to join the conversation.

  • crosire
More
5 years 1 month ago - 5 years 1 month ago #9 by crosire Replied by crosire on topic 21:9 Depth issue

Marty McFly wrote: And to workaround this, each shader would need to be patched in order for this to work - which wouldn't be a problem if every shader used the ReShade.fxh (which unifies depth access) but shaders like Depth3D don't do that.

Last edit: 5 years 1 month ago by crosire.

Please Log in or Create an account to join the conversation.

  • Martigen
More
5 years 4 weeks ago #10 by Martigen Replied by Martigen on topic 21:9 Depth issue

Ceroes wrote: The fix for this game is 21.3 / 16 for it to work with Marty McFly mxao and the depth view but it's still messed up for smaa depth edge detection it's has the Original issue it's treating the screen like it was displaying the game in 21:9 still

Yes, depth is broken in the SMAA.fx currently on github. Here is a fixed version: pastebin.com/KRjDzFgG

This is linked from this post here: reshade.me/forum/shader-discussion/5203-smaa#33192

Crosire will no doubt add this (or a similar version) to Github at a later date.

Please Log in or Create an account to join the conversation.

  • Ceroes
  • Topic Author
More
5 years 3 weeks ago #11 by Ceroes Replied by Ceroes on topic 21:9 Depth issue
Thanks it worked, it's nice cause while this game isn't the worse offender out there I have a few older games that could really really use it that may be having the same problem.

Please Log in or Create an account to join the conversation.

  • peronmls
More
4 years 10 months ago #12 by peronmls Replied by peronmls on topic 21:9 Depth issue

Marty McFly wrote: Hmm this is difficult to fix, since in theory, the padding on the outside should not be added by the game itself. And to workaround this, each shader would need to be patched in order for this to work - which wouldn't be a problem if every shader used the ReShade.fxh (which unifies depth access) but shaders like Depth3D don't do that.

To fix most shaders, open the ReShade.fxh and find this function:

float GetLinearizedDepth(float2 texcoord)
	{
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
		texcoord.y = 1.0 - texcoord.y;
#endif
		float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
		const float C = 0.01;
		depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
		depth = 1.0 - depth;
#endif
		const float N = 1.0;
		depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);

		return depth;
	}

Modify so it looks like this
float GetLinearizedDepth(float2 texcoord)
	{
float aspect_fix = 21.0 / 16.0; //adjust source/destination ratio
               texcoord.x = (texcoord.x - 0.5) * aspect_fix + 0.5 ;


#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
		texcoord.y = 1.0 - texcoord.y;
#endif
		float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
		const float C = 0.01;
		depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
		depth = 1.0 - depth;
#endif
		const float N = 1.0;
		depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);

		return depth;
	}
I'm trying to do this with QUINT. Without the ratio fix. I copied over what you posted. It breaks everything. I also tried renaming texcoord to uv because I didn't know if you were implying to us to do that. I can't ever use MXAO or DOF together because one is always flipped.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.