Depth Buffer Detection Modification

  • Posts: 578
2 years 2 months ago - 2 years 2 months ago #1 by thalixte
Hi Crosire !

I made some modifications in the Reshade code in order to enable depth buffer in games where it does not actually work (i made it because i am absolutely fan of the superDepth3D shader made by BlueSkyKnight, and the MXAO shader by MartyMcFly).
For instance in Elex, TitanFall 2, Project Cars 2, Shadow Warrior 2, Shadow Of War (full screen mode), Agents Of Mayhem...

What i did is retrieve the depth buffer texture at different stages, other than the rendering one. I retrieve the depth buffer texture at Output Merger state, or just before the game clears the buffer, at the clearDepthstencilView stage, I make a copy of this texture, then pass it to the draw_call_tracker instance, and retrieve it at the select_depthstencil_replacement stage.

In order to ensure compatibility with the existing features, i added an extra configuration tab, named "depth buffer detection settings", where the user can choose the depth buffer detection technique to use with the game (old post processing technique, before the game clears the depth buffer, or at the Output Merger stage).

If you agree with that, may i make a pull request on your github repo ?

My own repo is here: github.com/Thalixte/Reshade

:)
The following user(s) said Thank You: Wicked Sick, Alex_outer, brussell, acknowledge, DeMondo, OtisInf, Ryukou36, GP-Unity, BlueSkyKnight, mr_spongeworthy and 9 other people also said thanks.

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

  • Posts: 453
2 years 2 months ago - 2 years 2 months ago #2 by Martigen

thalixte wrote: Hi Crosire !

I made some modifications in the Reshade code in order to enable depth buffer in games where it does not actually work (i made it because i am absolutely fan of the superDepth3D shader made by BlueSkyDefender, and the MXAO shader by MartyMcFly).
For instance in Elex, Project Cars 2, Shadow Warrior 2, Shadow Of War (full screen mode), Agents Of Mayhem...

What i did is retrieve the depth buffer texture at different stages, other than the rendering one. I retrieve the depth buffer texture at Output Merger state, or just before the game clears the buffer, at the clearDepthstencilView stage, I make a copy of this texture, then pass it to the draw_call_tracker instance, and retrieve it at the select_depthstencil_replacement stage.

In order to ensure compatibility with the existing features, i added an extra configuration tab, named "depth buffer detection settings", where the user can choose the depth buffer detection technique to use with the game (old post processing technique, before the game clears the depth buffer, or at the Output Merger stage).

If you agree with that, may i make a pull request on your github repo ?

My own repo is here: github.com/Thalixte/Reshade

:)

Omg! We were only just thankful of the recent depthbuffer detection changes, though Elex didn't benefit. Thankyou! Will try this out.

Edit: Just realised I can't, don't have VS installed. Will wait for binaries :)

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

  • Posts: 578
2 years 2 months ago - 2 years 2 months ago #3 by thalixte
Martigen, where can i send to you the dll (don't know if it is possible to post it here)?

Some little screenies (w/ super3DDepth and DisplayDepth shaders).
Elex:
File Attachment:


File Attachment:


Shadow Warrior 2:
File Attachment:


File Attachment:


Project Cars 2:
File Attachment:


File Attachment:

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

  • Posts: 343
2 years 2 months ago #4 by OtisInf
Thalixte: great stuff :)

It's actually a great idea to pull the buffer from these other two locations. Isn't it taxing though to copy the textures around at that stage (as in: loss in performance?)

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

  • Posts: 578
2 years 2 months ago #5 by thalixte
It's seems that it's not, as i try (with some heuristics, and with the help of your great work in retrieving the number of vertices and drawcalls, even in deferred rendering) to limit as much as i can the number of copyResource, but i cannot test in a less powerfull rig than mine.

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

  • Posts: 527
2 years 2 months ago - 2 years 2 months ago #6 by lowenz
NICE, MAN!

If can can upload a binary we'll surely test it!

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

  • Posts: 578
2 years 2 months ago #7 by thalixte
Here is the link if you want to test: dxgi.dll

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

  • Posts: 527
2 years 2 months ago #8 by lowenz
A 32 bit version?

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

  • Posts: 578
2 years 2 months ago #9 by thalixte
Here it is: Reshade32.dll

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

  • Posts: 3723
2 years 2 months ago #10 by crosire

thalixte wrote: If you agree with that, may i make a pull request on your github repo ?

Go ahead! The worst that can happen is that I don't agree with how things are done and will review and/or modify accordingly or refuse the pull request for some reason. But I'm always happy to see new changes and proof that people actually do useful stuff with the ReShade codebase! So, yes please, make a pull request.
The following user(s) said Thank You: Wicked Sick

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

  • Posts: 578
2 years 2 months ago - 2 years 2 months ago #11 by thalixte
Thks Crosire ! Made the pull request. Hope you will find it usefull :)

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

  • Posts: 272
2 years 2 months ago #12 by robgrab
I'm super excited about the possibilities!

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

  • Posts: 527
2 years 2 months ago - 2 years 2 months ago #13 by lowenz
No luck - switching among the several possibilities - with SiN Emergence (an early Source-based game that really needs some indirect shadowing :D ) and MXAO (from the lastest shader package).

Can anyone try (thalixte too) ?

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

  • Posts: 527
2 years 2 months ago - 2 years 2 months ago #14 by lowenz
The same for Dark Messiah, man, those old Source (like Bloodlines) titles would really benefit of an AO pass.

(an old version of ENB can do that for Source based games, so it's not impossible to retrieve the depth buffer).

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

  • Posts: 578
2 years 2 months ago #15 by thalixte
Are those games d3d11 games ? The changes only impact d3d11 games.

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

  • Posts: 527
2 years 2 months ago - 2 years 2 months ago #16 by lowenz
No, D3D9.

But man, I CAN ALREADY LOVE YOU :D
With "second pass" we can now apply MXAO to Deus Ex Human Revolution!

screenshotcomparison.com/comparison/133347

But there's a strange behaviour! The pass number to choose to see the effect applied is angle (normal?) dependent!
As you can see in the screenshots above the pass is "Second", but *turning* in that same room need to switch to "First" to see the effect present (or applied?)

Still we all owe you man! IT'S GREAT! DX with MXAO! A dream come true!

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

  • Posts: 527
2 years 2 months ago #17 by lowenz
The 2 screenshots:


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

  • Posts: 578
2 years 2 months ago #18 by thalixte
You're welcome ;) I suggest you to use the DisplayDepth shader in order to better see the depth buffer...

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

  • Posts: 272
2 years 2 months ago - 2 years 2 months ago #19 by robgrab
Can't wait to try this with Bioshock 2 Remastered.

UPDATE: Didn't work. :(

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

  • Posts: 527
2 years 2 months ago - 2 years 2 months ago #20 by lowenz
It seems that the pass when (where?) you can retrieve the DB changes (First<->Second) on the camera angle/position.

File Attachment:

File Attachment:



How is this possible? Implementation issue of yours or game strange "feature" ? :D

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