Welcome, Guest.
Username: Password: Remember me

TOPIC: Recreating Mirror Mode mod using a shader?

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #1

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

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #2

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: 2 months 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: CelicetheGreat

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #3

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

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #4

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

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #5

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

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #6

No. ReShade always affects the HUD. That's just how it is.
Cheers, crosire =)
The administrator has disabled public write access.

Recreating Mirror Mode mod using a shader? 2 months 1 week ago #7

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

Recreating Mirror Mode mod using a shader? 2 months 5 days ago #8

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