[Release] Pcsx2 with depth buffer access

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago - 4 years 7 months ago #1 by Boulotaur2024 [Release] Pcsx2 with depth buffer access was created by Boulotaur2024


Valkyrie Profile 2 with Marty McFly's Ground Truth AO implementation running in PCSX2

This is a dirty hack of Reshade made to help getting access to depth buffer in games emulated by Pcsx2 emulator which is otherwise hard and really quirky.
The emulator does expose a depth buffer (not always but often), sometimes filled with the wrong data... but sometimes actually decent to use.
I will push the changes to my Reshade Github if anyone wants to see how it's done (it is naughty :D)


Instructions :
  • Install latest Pcsx2 SVN build
  • Install Reshade as you would normally do
  • Download and replace your existing Reshade opengl32.dll with the following alternative opengl32.dll :
  • mega.nz/#!vcsiDI6A!AkGWkVRQkJEelOYa7quAOI1cOxHfU-HuDBcS1CnVrTI

  • Download modified qUINT shaders HERE and drop them in the "\reshade-shaders\Shaders\" subfolder
  • Run the emulator once to make sure Reshade is working at all. Also please select OpenGL (Hardware) renderer in GSdx
  • Run pcsx2 again and select "pcsx2" in the "Hacks for custom apps" dropdownlist - in the Opengl tab in Reshade :
  • In Reshade.ini, set RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN to 1
Issues :
  • Atlus games are not working at all (Persona3, 4, Nocturne...)
  • Metal Gear solid 2 does not work : (
  • There is a more or less visible latency between the ssao buffer and the backbuffer
Recommandations :
  • Some games (Okami, Silent Hill 4, Fatal Frame... and maybe more) need a real boost to the depth output so if the resolution parameters are fine and you still don't see any ssao showing, in qUINT_common.fxh set it to :
float depth = tex2Dlod(sDepthBufferTex, float4(uv, 0, 0)).x * 100000;
  • Clicking on Reset upscale settings is a good way to reset & autodetect resolutions parameters per game.
    Additional resizing can be done with the Stretch mode selector
Last edit: 4 years 7 months ago by Boulotaur2024.
The following user(s) said Thank You: NattyDread, Pondural, Alex_outer, Nerd, Ryukou36, StuDentBR, Talley Rand, Zumokufu

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

  • Niko of Death
More
4 years 10 months ago #2 by Niko of Death Replied by Niko of Death on topic [Release] Pcsx2 with depth buffer access
Awesome! Sucks that Nocturne doesn't work, as that was going to be the first thing I was going to try, but not surprising given the issues it has with shadows. At least I can finally feel good about having to use D3D11 since I'm on AMD.

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

  • Nerd
More
4 years 10 months ago #3 by Nerd Replied by Nerd on topic [Release] Pcsx2 with depth buffer access
Atlus games, MGS2/3, and the KH games were the first to pop into my head when thinking about what games I was going to try first lol. Awesome work regardless!

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

  • anontsuki
More
4 years 10 months ago #4 by anontsuki Replied by anontsuki on topic [Release] Pcsx2 with depth buffer access
Hey, just wanted to kind of chime in here.

I tried your initial release of this modified reshade and had .... limited results. The main issue I had was in the depth buffer detection tab, I'd see some buffer things loading in and out incredibly quick, honestly like 100 times a second. I don't know the terminology of these things, but typically you'd select one of those boxes that's the depth buffer, those boxes and ranges or whatever weren't staying put.

This newer version doesn't seem to load/work properly for me, when named d3d11.dll, it doesn't load and when opengl32.dll, I get the famed "Can't Find Suitable PixelFormat" issue.

Also, if I'm not mistaken, to get ReShade loading with PCSX2 in general, you need to create a fix for PCSX2, since PCSX2 doesn't load the dll as one would expect. There was some talk about it on Github a while back, a guy created a fix that allowed for PCSX2 to forcefully load up d3d11.dll. (And you can create your own fix using Windows Compatibility Administrator Kit)

Would love to see how this progresses.

I would recommend calling your custom dll something else though from just d3d11.dll or opengl32.dll, maybe a version number and something that makes it obvious it's for PCSX2, like "PCSX2 DB ver x.x.dll" or something.

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

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago - 4 years 9 months ago #5 by Boulotaur2024 Replied by Boulotaur2024 on topic [Release] Pcsx2 with depth buffer access
D3D11 is rather clunky, I would suggest using OpenGL now that it's done : )

EDIT : If you still want to use D3D11, you can do so by renaming opengl32.dll to dxgi.dll

And for those of you that have issues with Pcsx2 not loading Reshade at all, use this fix :
reshade.me/forum/troubleshooting/4649-so...11-and-reshade#29813


For D3D11 the key to success is ALT-tabbing several times until you get the depth buffer showing : this is a timing issue I guess.
You can completely disregard the D3D11 tab, I don't use the code path Thalixte made because it's not needed here.

I would recommend using OpenGL and relative dll for more stability and ease of use : once loaded the DB shows immediately unlike the D3D11 version
Please give it a try (also the compatibility is a bit better)
Last edit: 4 years 9 months ago by Boulotaur2024.

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

  • anontsuki
More
4 years 10 months ago #6 by anontsuki Replied by anontsuki on topic [Release] Pcsx2 with depth buffer access
Ah okay, yeah that fix is exactly what I was talking about. Not sure how many people know about that and use PCSX2 as well.

I'll give the DLL's another try and it's good to know that I don't need to mess with the Depth Tab, guess things will be obvious or not if they work.

Do you have any idea why OpenGL32.dll was giving me that dumb error though? That's something that old versions of ReShade use to say but was fixed in.... 4.1? or something, so =/.

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

  • Gynther477
More
4 years 10 months ago #7 by Gynther477 Replied by Gynther477 on topic [Release] Pcsx2 with depth buffer access
I followed your instructions as best as I could, but everytime I try to boot a game with OpenGL hardware renderer I get the error from PCSX2:

"GS plugin failed to open. Your computer may have insufficient resources, or incompatible hardware/drivers."

However if I use your DX11 dll it works fine with the GSDX DX11 hardware, and the normal opengl32.dll that comes with reshade works fine as well with GSDX opengl, so I'm not sure what I do wrong. From what I tested in ratchet and clank, I can get depth buffer acces in dx11 by manually selecting it in the DX11 tab in reshade, but it isn't optimal since the depth buffer is misaligned, and I guess I need the opengl plugin to alter the reshade.ini to add the extra options that i can adjust the depth buffer height and width (atleast that's what I assume the dll will do).

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

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago #8 by Boulotaur2024 Replied by Boulotaur2024 on topic [Release] Pcsx2 with depth buffer access
I updated the OP with a new DLL that should be more stable (anontsuki you can confirm I think ?)

I guess it crashed because I was not using the same Windows SDK version as Crosire's.
He's using 10.0.17763.0 while I was using 10.0.18362.0...
Well it's a bit too early to tell now but right now it's my best guess...

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

  • anontsuki
More
4 years 10 months ago #9 by anontsuki Replied by anontsuki on topic [Release] Pcsx2 with depth buffer access
Yup, the new OGL dll works just fine in not crashing anymore.

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

  • matsilagi
More
4 years 10 months ago #10 by matsilagi Replied by matsilagi on topic [Release] Pcsx2 with depth buffer access
OpenGL worked, DX11 didn't even with the fix.

Amazing to see ReShade working on PCSX2, hopefully you can expand that list and make even more emus compatible, this is waay more than the GS shader can offer for sure!

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

  • Talley Rand
More
4 years 10 months ago #11 by Talley Rand Replied by Talley Rand on topic [Release] Pcsx2 with depth buffer access
So i've tested opengl32 with sh3 and sh4 and display depth shows only a small patch of screen and even that only in normal map mode.
Do you know what may be the issue here? I've set everything according to the instruction in the first post.
Examples of the output:

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

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago - 4 years 10 months ago #12 by Boulotaur2024 Replied by Boulotaur2024 on topic [Release] Pcsx2 with depth buffer access
Mmm.... interesting... do you have an NVIDIA card ?

I never tested it with NVIDIA so I'm unsure about the results.
Judging from the screens the glBlitFramebuffer call might completely fail on NVIDIA, thus catching only a small subset of the screen.

SH4 work fine here for sure on my old AMD HD 7900. Pretty sure SH3 likewise (more or less same engine)
Any better results with some other games... ?

BTW has anyone here got it working like... just fine... or not :D ?
Last edit: 4 years 10 months ago by Boulotaur2024.

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

  • anontsuki
More
4 years 10 months ago #13 by anontsuki Replied by anontsuki on topic [Release] Pcsx2 with depth buffer access
Nope, I never got anything to work, Talley Rand got further than me with their normals atleast showing something. No matter what I do or use, I don't get a depth buffer and I don't get anything showing, it's a pure white screen or a blue, whatever color, screen for normals.

DisplayDepth doesn't show anything, SMAA depth debug doesn't show anything. =( Nothing works on my end =(.

GTX 1070 here.

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

  • otherman
More
4 years 10 months ago - 4 years 10 months ago #14 by otherman Replied by otherman on topic [Release] Pcsx2 with depth buffer access
1060 here, same problem.
Last edit: 4 years 10 months ago by otherman.

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

  • Talley Rand
More
4 years 10 months ago #15 by Talley Rand Replied by Talley Rand on topic [Release] Pcsx2 with depth buffer access
I've tested with some other games and had the same issue of only patch of the screen being visible in normal mode. And yes, i have an nvidia card too (1080Ti).
What pcsx2 build are using, btw?

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

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago #16 by Boulotaur2024 Replied by Boulotaur2024 on topic [Release] Pcsx2 with depth buffer access
Yeah it seems NVIDIA related.

Hopeefully tomorrow I can test it at work, my desktop pc has a gtx 750.
I spent a good portion of the day bypassing the proxy to download... everything to boot it on my rig at work.

Funnily enough, there's no displacement/misalignment issue either with Intel Integrated graphics card.
So if you're a happy owner of Intel Integrated graphics, then you are a lucky man : it works ! Just like with AMD

It's a shame OpenGL can be interpretated so "loosely" from a vendor to another.
A call has its rules and expected results, it shouldn't vary so much from AMD to NVIDIA.
Oh well...
The following user(s) said Thank You: MrCassidy

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

  • anontsuki
More
4 years 10 months ago #17 by anontsuki Replied by anontsuki on topic [Release] Pcsx2 with depth buffer access
I was using the latest PCSX2 ver from buildbot a few days ago, but I'm not sure there's going to be such a huge change between versions in the past several months.

In some ways, I hope it's an Nvidia related problem, but then again, if it is, that sucks and will probably make things more difficult =(.

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

  • MrCassidy
More
4 years 10 months ago - 4 years 10 months ago #18 by MrCassidy Replied by MrCassidy on topic [Release] Pcsx2 with depth buffer access
Hi there. Made an account just so I could report my findings...
So i followed your instructions to a T, and I found that your DX11 depth buffer plugin for reshade works decently well with Square Enix/Soft games. And yes, I'm on a GTX 1070. Here are some screen shots to show my results.



But I noticed on KH 2 that it's just slightly above the bottom of the screen, and when applied to the actual game looks pretty Janky.


Any idea why this might be happening, and how I might fix it? :/
But yes... I can also confirm what everyone else is saying when it comes to the open gl plugin. it's a shame since that seemed like the one that would work for KH2... aww well. Any suggestions?
Last edit: 4 years 10 months ago by MrCassidy. Reason: typo

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

  • StuDentBR
More
4 years 10 months ago #19 by StuDentBR Replied by StuDentBR on topic [Release] Pcsx2 with depth buffer access
I am definatelly interested in this... Did you try god of war games ?

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

  • Boulotaur2024
  • Topic Author
More
4 years 10 months ago - 4 years 10 months ago #20 by Boulotaur2024 Replied by Boulotaur2024 on topic [Release] Pcsx2 with depth buffer access
So it was an excruciatingly painful debugging work but after switching to NVIDIA and spending hours trying to figure out why it didn't work.
I finally managed to get it working fine on NVIDIA !

abload.de/img/captureblj0g.jpg

For now I'll let people choose between NVIDIA or AMD dll but I'm pretty sure the NVIDIA one works with both cards, just in case...
I dropped entirely support for D3D11 as it was... buggy, now it's all about OpenGL (even though I hate everything about it :D)

Enjoy :P
Last edit: 4 years 10 months ago by Boulotaur2024.

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.