Depth buffer detection modifications

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #141 by thalixte
Ok, found the bug for Timeshift, i guess. Could you please try those ones ?
The following user(s) said Thank You: Androll

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

  • Posts: 42
2 years 3 months ago - 2 years 3 months ago #142 by Nerrel
MXAO used to be capable of working in N64 games via GlideN64 plugin (openGL)... surprisingly well, in fact.
Warning: Spoiler! [ Click to expand ]

Unfortunately, it no longer does as changes to the plugin have resulted in the AO being applied incorrectly. It's offset vertically and lags behind the camera:
Warning: Spoiler! [ Click to expand ]

The developer of GlideN64 said this is because Reshade is drawing from frame buffer objects (where most draw calls are made) rather than the depth buffer, and FBO is scaling the image in ways that are breaking the MXAO effect. Do you think your modifications would help in this case? If I could get an openglx32.dll to experiment with I could see for myself if anything changes. Either way, thanks for working on this.

(I'm also hoping RE4 can be made to work with this, since it would go really well with Cris and Albert's RE4HD project)

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

  • Posts: 530
2 years 3 months ago #143 by lowenz
Timeshift working now!

Dark Messiah and Sin Emergence (Source 2006 games) still can't show the ReShade interface.

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

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #144 by thalixte

lowenz wrote: Timeshift working now!

Dark Messiah and Sin Emergence (Source 2006 games) still can't show the ReShade interface.


Good news for TimeShift :) But, when i tested it, i found that depth buffer worked perfectly with the 3.1.2 current release (which not embed any of my modifications for the moment).

Will test RE4 first, then will look at Source 2006 games, if i find some time.
Question: have you tested Source 2006 games with the current 3.1.2 Reshade release ? Does the Reshade interface appear correctly in this case ?

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

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #145 by thalixte

Nerrel wrote: MXAO used to be capable of working in N64 games via GlideN64 plugin (openGL)... surprisingly well, in fact.

Unfortunately, it no longer does as changes to the plugin have resulted in the AO being applied incorrectly. It's offset vertically and lags behind the camera:

The developer of GlideN64 said this is because Reshade is drawing from frame buffer objects (where most draw calls are made) rather than the depth buffer, and FBO is scaling the image in ways that are breaking the MXAO effect. Do you think your modifications would help in this case? If I could get an openglx32.dll to experiment with I could see for myself if anything changes. Either way, thanks for working on this.

(I'm also hoping RE4 can be made to work with this, since it would go really well with Cris and Albert's RE4HD project)


Sorry to say that my modifs do not impact OpenGL games for the moment. The best you can do here is to ask MartyMcFly (the author of the excellent MXAO shader) to see if he could help you.

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

  • Posts: 580
2 years 3 months ago #146 by thalixte
@Crosire: when i am finished with the DX9 modifs for depth buffer detection, may i make a pull request in the Reshade repo in order to publish it ?

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

  • Posts: 530
2 years 3 months ago - 2 years 3 months ago #147 by lowenz

thalixte wrote: Good news for TimeShift :) But, when i tested it, i found that depth buffer worked pefectly with the 3.1.2 current release (which not embed any of my modifications for the moment).

I know, but I found strange the "regression". So you can confirm that your reshade implementation can fail where the original implementation can do good?

Question: have you tested Source 2006 games with the current 3.1.2 Reshade release ? Does the Reshade interface appear correctly in this case ?

Yes, Yes.

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

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #148 by thalixte

lowenz wrote:

thalixte wrote: Good news for TimeShift :) But, when i tested it, i found that depth buffer worked pefectly with the 3.1.2 current release (which not embed any of my modifications for the moment).

I know, but I found strange the "regression". So you can confirm that your reshade implementation can fail where the original implementation can do good?


Again, thks for your tests and feedbacks :cheer:. Normally , it is not the case anymore, cause i fixed it. That's the reason of the debug step ;) . I do not own all the games, so the more games to test, the better it is. I firstly tested my implementation in one game (ME2), where the error did not occur because the game engine did not reset the device during the game session, as U3 engines do. My reshade implementation of dx9 is a fork of the last master branch of Reshade.

lowenz wrote: Question: have you tested Source 2006 games with the current 3.1.2 Reshade release ? Does the Reshade interface appear correctly in this case ?
Yes, Yes.


OK, so i need to investigate. Crosire made a modif in his last commit regarding the UI in d3d9 ( github.com/crosire/reshade/commit/477dda...5a0e258cf0b7ad401aaa ). I need to test if this behaviour comes from my changes or his changes. You can check my modifs here: github.com/Thalixte/Reshade/commits/d3d9 .

One last thing to know: the 3.1.2 reshade release is not up-to-date, considering the github master branch.

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

  • Posts: 26
2 years 3 months ago - 2 years 3 months ago #149 by AladinZ
Hello, could you please investigate this game named 'FUEL' by Codemasters? The bepthbuffer never worked properly.

Here are screenshots of what's happening:

Depth view on


Depth view off


I dream of the day depthbuffer will work properly in this game.

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

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #150 by thalixte

AladinZ wrote: Hello, could you please investigate this game named 'FUEL' by Codemasters? The bepthbuffer never worked properly.

Here are screenshots of what's happening:

I dream of the day depthbuffer will work properly in this game.


Hello,

It reminds me the same pb as in Elex (dx11). In Elex, some depth buffers are related to the UI elements. That's why, in my modifs, I introduced a setting to select the appropriate depthstencil instance, i.e., a number which indicates to Reshade when it should retrieve the depth buffer (the first time the game clears a depth buffer, the second time, the third time, and so on...), so i can filter the appropriate one.
In Elex, this allows to display the depth buffer related to the rendering scene, not the ones related to the UI elements.

Do you know which version of DirectX is used in Fuel ? If it is DX11, my current modifs should help. If it is for DirectX10, you will need to wait for me to implement my modifs for this version of DirectX.

If it is for DX9, i should find a similar method for this version of the dll (but dx9 works differently from DX10 and DX11)...

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

  • Posts: 46
2 years 3 months ago #151 by conan2k
Tested the latest DLLs in the following DX9 games so far (will test more as I have time):
1) The Witcher - Enhanced Edition (the 1st one from series)
Only UI and subtitles are present in the retrieved depth map (i.e. no changes from the original ReShade). Most likely the same problem as with FUEL, which you've described above.

2) King's Bounty Warriors of the North - Complete Edition
The retrieved depth map is empty (white).

3) Mass Effect (the 1st one from series)
Works just fine!

4) Dishonored (the 1st one from series)
Works just fine!

If you need The Witcher and King's Bounty games for testing, they are available for cheap on GOG (The Witcher is dirt-cheap actually). I can donate some funds to you via PayPal for such purchases if you have a compatible e-Wallet.

In any event, thanks a lot for your effort and continuous support!

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

  • Posts: 26
2 years 3 months ago #152 by AladinZ

thalixte wrote:

AladinZ wrote: Hello, could you please investigate this game named 'FUEL' by Codemasters? The bepthbuffer never worked properly.

Here are screenshots of what's happening:

I dream of the day depthbuffer will work properly in this game.


Hello,

It reminds me the same pb as in Elex (dx11). In Elex, some depth buffers are related to the UI elements. That's why, in my modifs, I introduced a setting to select the appropriate depthstencil instance, i.e., a number which indicates to Reshade when it should retrieve the depth buffer (the first time the game clears a depth buffer, the second time, the third time, and so on...), so i can filter the appropriate one.
In Elex, this allows to display the depth buffer related to the rendering scene, not the ones related to the UI elements.

Do you know which version of DirectX is used in Fuel ? If it is DX11, my current modifs should help. If it is for DirectX10, you will need to wait for me to implement my modifs for this version of DirectX.

If it is for DX9, i should find a similar method for this version of the dll (but dx9 works differently from DX10 and DX11)...



The game uses DX9 unfortunately, but I can wait. Been playing the game for years, and likely to keep playing it for a long time to come.

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

  • Posts: 179
2 years 3 months ago #153 by klotim
Shogun 2 total war has blank depth buffer as well, dx 11

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

  • Posts: 228
2 years 3 months ago #154 by Uncle Crassius
Getting an "untrusted system file" with the latest dxgi.dll in Far Cry 5. The unmodified dll works but yields no depth buffer access, at least for me (with AA turned off).

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

  • Posts: 3740
2 years 3 months ago #155 by crosire
Official ReShade is whitelisted. Custom builds are not.

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

  • Posts: 46
2 years 3 months ago #156 by conan2k
Tested more DX9 games (for which there is no depth buffer access with the original ReShade):
1) XCOM: Enemy Unknown - Complete Edition
Works just fine!

2) Resident Evil 6
Works just fine!

3) Fallout 3 GotY
The depth map is empty (white). However, when the game is in the 3rd-person view mode, the depth map is retrieved successfully (the same behavior as with the original ReShade).

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

  • Posts: 228
2 years 3 months ago #157 by Uncle Crassius

crosire wrote: Official ReShade is whitelisted. Custom builds are not.


I see. Waiting for an official implementation of the detection improvements then. Thanks for clearing that up.

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

  • Posts: 42
2 years 3 months ago - 2 years 3 months ago #158 by Nerrel

thalixte wrote: Sorry to say that my modifs do not impact OpenGL games for the moment. The best you can do here is to ask MartyMcFly (the author of the excellent MXAO shader) to see if he could help you.


Nuts. I asked MartyMcFly about this a while ago and there wasn't much he could do, as it's a ReShade issue. Instead of using the FBO, which is automatically chosen, ReShade would have to be manually set to use the depth buffer instead in order for GlideN64 to work, but manually selecting a source isn't possible at the moment. Crosire seemed to say that it probably never will be, but I'm holding out hope that some kind of workaround will eventually materialize... After all, it did work at one point. Thanks for your answer!

conan2k wrote: 2) Resident Evil 6
Works just fine!


I remember forcing AO through Inspector, which mainly gave the choice of AO from RE5 or Hawken. RE5 looked more natural but was subtle and didn't apply to distant objects. MXAO should blow those options out of the water.

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

  • Posts: 580
2 years 3 months ago - 2 years 3 months ago #159 by thalixte

conan2k wrote: Tested more DX9 games (for which there is no depth buffer access with the original ReShade):
1) XCOM: Enemy Unknown - Complete Edition
Works just fine!

2) Resident Evil 6
Works just fine!

3) Fallout 3 GotY
The depth map is empty (white). However, when the game is in the 3rd-person view mode, the depth map is retrieved successfully (the same behavior as with the original ReShade).


Cool! Thks for your feedback ;)

I have good news and bad news for Vanquish:
Good news is that i am able to retrieve the depth buffer (in fact, the actual build is able to retrieve it, if i disable an early rejection that checks the aspect ratio of the depthstencil surface in the code, in the on_set_depthstencil_surface method of the d3d9_runtime class).
The bad news is that the depthstencil texture is embedded in a 4096X4096 square, so when it is displayed by the shader, it is shrinked :( ...

I don't know if it is possible to crop a depth buffer texture in d3d9, so i wonder if it would be possible inside the shader itself (or in the Reshade.fxh that embed the method to retrieve the depth infos)...

@Crosire, what do you think about that ?
The following user(s) said Thank You: Uncle Crassius

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

  • Posts: 46
2 years 3 months ago #160 by conan2k
Two more DX9 games have been tested:
1) F.E.A.R. 2: Project Origin
Works just fine!

2) Far Cry 2
Only main character's hands and weapon are present in the retrieved depth map. At the same time, the depth map is completely empty with the original ReShade. Also, DX10 renderer is available in this game but I haven't tested it since your changes are not ported to DX10 yet.

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