Recreating Mirror Mode mod using a shader?

  • CelicetheGreat
  • Topic Author
More
5 years 3 months ago #1 by CelicetheGreat Recreating Mirror Mode mod using a shader? was created by CelicetheGreat
I had wrote up a large post but the forum decided it was spam and threw it out... So I'm gonna be a lot more brief now :(

Years ago someone created a mirror mode effect using the FXAA shader included with DSFix for Dark Souls. Here is a link to the download from the original reddit post,

www.reddit.com/r/darksouls/comments/17k3ai/pc_mirror_mode_mod/

Here is the shader code itself (posting this in the original post was what seemed to get my post regarded as spam and thrown out),

pastebin.com/L5vRj3Dq

A game update at some time broke the shader effect. I was wondering if it would be possible to recreate the mirroring effect. The big thing is that the original mod didn't affect the 2D hud elements which was really nice.

Thank you for any help or tips you guys can provide.

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

  • Marty McFly
More
5 years 3 months ago - 5 years 3 months ago #2 by Marty McFly Replied by Marty McFly on topic Recreating Mirror Mode mod using a shader?
texture BackBufferTex : COLOR;
sampler BackBuffer { Texture = BackBufferTex; };

void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
{
	texcoord.x = (id == 2) ? 2.0 : 0.0;
	texcoord.y = (id == 1) ? 2.0 : 0.0;
	position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}

void PS_Mirror(in float4 position : SV_Position, in float2 texcoord : TEXCOORD, out float4 o : SV_Target0)
{
	o = tex2D(BackBuffer, float2(1 - texcoord.x, texcoord.y));
}

technique MirrorScreen
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader  = PS_Mirror;
	}
}

This is basically everything. Your original source code also applies FXAA but I omitted it since ReShade has a separate FXAA (and SMAA) shader. Save as any .fx file and drop it where ReShade loads the shaders.
Last edit: 5 years 3 months ago by Marty McFly.
The following user(s) said Thank You: CelicetheGreat

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

  • CelicetheGreat
  • Topic Author
More
5 years 3 months ago #3 by CelicetheGreat Replied by CelicetheGreat on topic Recreating Mirror Mode mod using a shader?
Thank you for setting it up for reshade for me :) But it doesn't seem to keep the UI elements unflipped like the original mod does.

This is what it looks like if I use the original shader, and the problem it causes in the latest version of Dark Souls:

i.imgur.com/unLsuZc.jpg
i.imgur.com/40z3XMR.jpg
i.imgur.com/gXazUfp.jpg

The problem is it looks like any alpha effects are not mirrored in the image, such as the tree dof silhouettes, character hair, bonfire effects, and many other things. Originally, all of these worked and the UI stayed left-to-right while only 3D geometry appeared flipped. A few effects like sunshafts and the lock-on icon had problems, but nothing like the above problems.

When using the shader you posted, I don't notice any of the above problems, but I do see that the UI is flipped with the rest of the image. This is what the shader you posted looks like in-game (and some other unrelated shaders on too),

i.imgur.com/WWcRh9x.jpg
i.imgur.com/F9CpTqG.jpg

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

  • Marty McFly
More
5 years 3 months ago #4 by Marty McFly Replied by Marty McFly on topic Recreating Mirror Mode mod using a shader?
What you request is not possible, ReShade can't detect UI, its shaders happen after any processing. Even if it was possible to detect where the UI elements are, the mirrored image would need to reconstruct what's behind them and that's not possible.

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

  • CelicetheGreat
  • Topic Author
More
5 years 3 months ago #5 by CelicetheGreat Replied by CelicetheGreat on topic Recreating Mirror Mode mod using a shader?
I realized that same thing. But that's why I wanted to ask here in case anyone saw what exactly the FXAA shader was doing that let it flip the image without touching the HUD. It is the only shader required for the mod to work, so I assume whatever would affect the HUD not being flipped would also be in the FXAA shader I linked to.

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

  • crosire
More
5 years 3 months ago #6 by crosire Replied by crosire on topic Recreating Mirror Mode mod using a shader?
No. ReShade always affects the HUD. That's just how it is.

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

  • CelicetheGreat
  • Topic Author
More
5 years 3 months ago #7 by CelicetheGreat Replied by CelicetheGreat on topic Recreating Mirror Mode mod using a shader?
I contacted the author of DSfix, and according to him, the reason the shader works (or worked) was that originally DSfix applied the shader effect before the game itself applied alpha effects. So it was a game-specific hack that seems to be lost to newer revisions of the game Dark Souls.

Thank you for both of your inputs crosire and Marty McFly.

I noticed the depthbuffer has a preview feature for the 3D geometry. If the shader is able to detect only 3D geometry, could it perhaps be able to also mirror only that detected geometry, or am I grossly misunderstanding or oversimplifying what the depth buffer stuff is all about?

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

  • OtisInf
More
5 years 3 months ago #8 by OtisInf Replied by OtisInf on topic Recreating Mirror Mode mod using a shader?

CelicetheGreat wrote: I contacted the author of DSfix, and according to him, the reason the shader works (or worked) was that originally DSfix applied the shader effect before the game itself applied alpha effects. So it was a game-specific hack that seems to be lost to newer revisions of the game Dark Souls.

Thank you for both of your inputs crosire and Marty McFly.

I noticed the depthbuffer has a preview feature for the 3D geometry. If the shader is able to detect only 3D geometry, could it perhaps be able to also mirror only that detected geometry, or am I grossly misunderstanding or oversimplifying what the depth buffer stuff is all about?


no:

Even if it was possible to detect where the UI elements are, the mirrored image would need to reconstruct what's behind them and that's not possible.

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.