Welcome, Guest.
Username: Password: Remember me

TOPIC: 21:9 Depth issue

21:9 Depth issue 6 months 13 hours ago #1

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

The administrator has disabled public write access.

21:9 Depth issue 6 months 8 hours ago #2

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 administrator has disabled public write access.
The following user(s) said Thank You: Ceroes

21:9 Depth issue 6 months 2 hours ago #3

Thanks I will try this out as soon as I'm off work.
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #4

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 months 4 weeks ago by Ceroes.
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #5

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.
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #6

What Ceroes means is that the images do not match exactly still. For that adjust the "aspect_fix" value.
Cheers, crosire =)
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #7

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 administrator has disabled public write access.
The following user(s) said Thank You: Ceroes

21:9 Depth issue 5 months 4 weeks ago #8

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 months 4 weeks ago by Ceroes.
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #9

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.
Cheers, crosire =)
Last Edit: 5 months 4 weeks ago by crosire.
The administrator has disabled public write access.

21:9 Depth issue 5 months 4 weeks ago #10

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.
The administrator has disabled public write access.

21:9 Depth issue 5 months 2 weeks ago #11

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.
The administrator has disabled public write access.

21:9 Depth issue 3 months 1 week ago #12

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.
The administrator has disabled public write access.