Depth buffer detection modifications
- matsilagi
-
conan2k wrote:
thalixte wrote: Again, big thk U. There's nothing more frustrating than facing a behaviour i do not understand... is it possible for you to send me a save in L4D2 ?
There is no need in a save in L4D2. Just select "Single Player" and you'll be able to choose from different campaigns and levels. L4D2 screenshots I'm attaching are from the very beginning of "Dead Center" campaign (1st level).
But, in general, I can of course send you logs, crash logs, saves, etc. from other games if will be needed. I.e. any help you might need, just name it
On the other note, I've tried to compare depth maps retrieved by the old build 64 (the one that seemed to work fine) and the new build 85. And, now I see that the depth map retrieved by the build 64 doesn't look as 100% correct (but it was "stable" and allowed to apply MXAO and DOF). The given behavior is consistent across different levels and campaigns.
Hope these screenshots will help to figure out what's going on in the game:
Warning: Spoiler!
- Original scene ("Dead Center" campaign, 1st level)
- Depth map retrieved by the build 64 (Flashlight is OFF)
- Depth map retrieved by the build 64 (Flashlight is ON)
- Depth map retrieved by the build 85 (Flashlight is OFF)
Yes, it looks the same as the depth map retrieved by the build 64 when the Flashlight is ON...
- Depth map retrieved by the build 85 (Flashlight is ON)
Yeah, i had that confirmed a while before. It flickered a lot less, but wasn't correct.
As weird as it seems, every time it flickers, it always gets the depth buffer of the skybox (Like when you turned the flashlight, the highlighted area was the skybox), with it off, it would occasionaly break the Z part of the textures (Like the one Alyx pic shown earlier on HL2) or would work completely OK (Ignoring the FPS guns in HL2's case, apparently L4D2.
Would getting the game's Source Code help? There are versions of the Source Engine 2007 which may help on this quest. Since all of the SE versions (Besides Black Mesa) uses the same logic for depth buffers.
EDIT: Pasting it here anyways : github.com/csnxs/source-2007/tree/master/src_main
Look around the folders and you will eventually find the ones releated to rendering, pretty sure you might find awnsers there.
- robgrab
-
This first video shows RE4 running with the April 6th release. Notice the settings don't change as I leave and re-enter each area.
This second video shows RE4 running with the version released on April 8th. Notice I have to change settings each time I leave the area. Also if the setting number is an odd number you need to select an even number once you leave that area. Besides that a setting that previously didn't work in that area will work as long as the value is changing to a different number. Hopefully the video will explain it better than I can with words.
- thalixte
-
Topic Author
I have to deal with different behaviours from one game to another, so i have to point out where is the difference . Unfortunately, i am very busy right now, so i cannot test as much as i would.
Thk U

I confirm that a save would be great...
- thalixte
-
Topic Author
matsilagi wrote:
conan2k wrote: Look around the folders and you will eventually find the ones releated to rendering, pretty sure you might find awnsers there.
Can you test this specific dl for L4D2 (and maybe other source engine games) ?
d3d9_32bits_L4D2.zip
My settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=0
DepthBufferClearingFlagNumber=2
DepthBufferTextureFormat=0
RestrictDepthBufferDimensions=1
- thalixte
-
Topic Author
jminternelia wrote:
thalixte wrote: DXHR works on my rig. But i have to disable anti-aliasing in the game settings...
As soon as i can, i send to you my conf.
That would be fantastic. I did get some progress at getting dof to work, but def send me that config info, as with how I have it now, it does like Arkham Knight and periodically the depth buffer is blank and the effect vanishes.
imgur.com/RaG8slj
imgur.com/SJfTCFZ
imgur.com/FOlMx2o
imgur.com/ck10IC3
Thalixte this is absolutely amazing work. This should absolutely be merged into the main branch (my opinion only). The only other game I really wish this would work for is Ghostbusters, but the game flat out crashes on startup. It's an old dx8 game and something something engine .cpp. Anyway, again, thanks so much for this. Fantastic stuff!
Sorry, i made a mistake: my settings were for Deux Ex Mankind, not Deux Ex Human Revolution, but as soon as i can, will test DXHR

- thalixte
-
Topic Author
lowenz wrote:
Can we have the lastest D3D11/DXGI implementations (32/64) to test?thalixte wrote: DXHR works on my rig. But i have to disable anti-aliasing in the game settings...
As soon as i can, i send to you my conf.
It is as easy as renaming the d3d9.dll in dxgi.dll (as it embeds the last dx11 changes for depth buffer detection).
- lowenz
-
Video: www25.zippyshare.com/v/aHxSco0g/file.html
- jminternelia
-
thalixte wrote:
lowenz wrote:
Can we have the lastest D3D11/DXGI implementations (32/64) to test?thalixte wrote: DXHR works on my rig. But i have to disable anti-aliasing in the game settings...
As soon as i can, i send to you my conf.
It is as easy as renaming the d3d9.dll in dxgi.dll (as it embeds the last dx11 changes for depth buffer detection).
I am just confirming...
So use your d3d9.dll and rename it dxgi.dll? Do we run the game in DX9 or DX11? I was using your d3d11 32 bit dll, with the following settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=2
DepthBufferTextureFormat=44
I didn't get to play very extensively with it, and I hadn't disabled MSAA.
Thanks!
- thalixte
-
Topic Author
lowenz wrote: Source Engine keeps showing the same behaviour: some parts of the scene are susceptible to "third" and other ones to "fourth" (the remaining part got artifacts).
Video: www25.zippyshare.com/v/aHxSco0g/file.html
Is it sin emergence ? If it is possible, do you have a save ? Thks...
- thalixte
-
Topic Author
jminternelia wrote:
thalixte wrote:
lowenz wrote:
Can we have the lastest D3D11/DXGI implementations (32/64) to test?thalixte wrote: DXHR works on my rig. But i have to disable anti-aliasing in the game settings...
As soon as i can, i send to you my conf.
It is as easy as renaming the d3d9.dll in dxgi.dll (as it embeds the last dx11 changes for depth buffer detection).
I am just confirming...
So use your d3d9.dll and rename it dxgi.dll? Do we run the game in DX9 or DX11? I was using your d3d11 32 bit dll, with the following settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=2
DepthBufferTextureFormat=44
I didn't get to play very extensively with it, and I hadn't disabled MSAA.
Thanks!
Ingame MSAA must be disabled (use another anti-aliasing technique, provided by the driver, for instance). Also, do you know which version of DirectX the game uses ?
- jminternelia
-
thalixte wrote:
jminternelia wrote:
thalixte wrote:
lowenz wrote:
Can we have the lastest D3D11/DXGI implementations (32/64) to test?thalixte wrote: DXHR works on my rig. But i have to disable anti-aliasing in the game settings...
As soon as i can, i send to you my conf.
It is as easy as renaming the d3d9.dll in dxgi.dll (as it embeds the last dx11 changes for depth buffer detection).
I am just confirming...
So use your d3d9.dll and rename it dxgi.dll? Do we run the game in DX9 or DX11? I was using your d3d11 32 bit dll, with the following settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=2
DepthBufferTextureFormat=44
I didn't get to play very extensively with it, and I hadn't disabled MSAA.
Thanks!
Ingame MSAA must be disabled (use another anti-aliasing technique, provided by the driver, for instance). Also, do you know which version of DirectX the game uses ?
You can switch between DX9 and DX11. I am using DX11 for the added eye candy. [strike]I've discovered that the occasionally when enabling MXAO and DoF, while DoF will sometimes cut out, MXAO will still be visible.[/strike] (Edit: RestrictDepthBufferDimensions was set to 0. Changing to 1 fixed that particular issue.)
Showing display depth reveals an all white screen, with some decals of a nearby phonebooth. Then, also, there are times that both MXAO and DoF aren't visible. I am using your latest dxgi 32 bit. MSAA appears to have no effect on depth buffer being read correctly, I get the same results with it enabled as I do disabled. [strike]I'll upload a video to explain better.[/strike] Done.
(All AA is disabled)
This demonstrates that AA has zero effect on anything. [strike]Also, perhaps not related to your fix, may be something I'll send to Marty, when the gun is drawn, the entire screen except for the gun is blurred. This happens regardless of the depth linearization setting (100 or 1000[/strike]) This was my fault. I had fADOF_HyperFocus set WAY too low.
- lowenz
-
You can see the issue in the starting screen too! (and the interaction with the Afterburner overlay)thalixte wrote:
lowenz wrote: Source Engine keeps showing the same behaviour: some parts of the scene are susceptible to "third" and other ones to "fourth" (the remaining part got artifacts).
Video: www25.zippyshare.com/v/aHxSco0g/file.html
Is it sin emergence ? If it is possible, do you have a save ? Thks...

It works on the HL2 menu, but in the rest of the game its all broken.
- conan2k
-
thalixte wrote:
matsilagi wrote:
conan2k wrote: Look around the folders and you will eventually find the ones releated to rendering, pretty sure you might find awnsers there.
Can you test this specific dl for L4D2 (and maybe other source engine games) ?
d3d9_32bits_L4D2.zip
My settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=0
DepthBufferClearingFlagNumber=2
DepthBufferTextureFormat=0
RestrictDepthBufferDimensions=1
Tested DLL in L4D2. Well, it's close but there are still depth-test issues which break the game rendering:
1) Good
- The depth buffer access seems to be stable. I haven't noticed any flickering in tested areas
- The depth map seems to be retrieved correctly even when the Flashlight is turned ON (this was never the case before)
2) Bad
- The light beam coming from the Flashlight looks dull (it's much brighter normally). However, switching to the "Post-processing" mode and back fixes the issue
- The light beam coming from the Flashlight tends to "catch" shadows that are then "carried" together with the beam
- Bluish glowing outline around "invisible" companions occasionally turns into glowing filled silhouette even if companions are still completely obscured (normally, this glowing silhouette effect can only be seen when a companion is about to appear in the field of view)
- thalixte
-
Topic Author
conan2k wrote:
thalixte wrote:
matsilagi wrote:
conan2k wrote: Look around the folders and you will eventually find the ones releated to rendering, pretty sure you might find awnsers there.
Can you test this specific dl for L4D2 (and maybe other source engine games) ?
d3d9_32bits_L4D2.zip
My settings:
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=0
DepthBufferClearingFlagNumber=2
DepthBufferTextureFormat=0
RestrictDepthBufferDimensions=1
Tested DLL in L4D2. Well, it's close but there are still depth-test issues which break the game rendering:
1) Good
- The depth buffer access seems to be stable. I haven't noticed any flickering in tested areas
- The depth map seems to be retrieved correctly even when the Flashlight is turned ON (this was never the case before)
2) Bad
- The light beam coming from the Flashlight looks dull (it's much brighter normally). However, switching to the "Post-processing" mode and back fixes the issue
- The light beam coming from the Flashlight tends to "catch" shadows that are then "carried" together with the beam
- Bluish glowing outline around "invisible" companions occasionally turns into glowing filled silhouette even if companions are still completely obscured (normally, this glowing silhouette effect can only be seen when a companion is about to appear in the field of view)
Oups. It becomes complicated


I think i will send to you all my latest releases, so you can tell me where the dll became instable (both for RE4HD than the source engine games)...
- thalixte
-
Topic Author
jminternelia wrote:
This demonstrates that AA has zero effect on anything. [strike]Also, perhaps not related to your fix, may be something I'll send to Marty, when the gun is drawn, the entire screen except for the gun is blurred. This happens regardless of the depth linearization setting (100 or 1000[/strike]) This was my fault. I had fADOF_HyperFocus set WAY too low.
Just tested the game (at the very beginning). No problem in my case. Could you test those settings:
PreprocessorDefinitions=RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=75,RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0,RESHADE_DEPTH_INPUT_IS_REVERSED=0,RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=1
[DEPTH_BUFFER_DETECTION]
DepthBufferRetrievalMode=1
DepthBufferClearingNumber=0
DepthBufferTextureFormat=44
- conan2k
-
thalixte wrote: Oups. It becomes complicated
I wish i find a way to make it work whatever the situation
I think i will send to you all my latest releases, so you can tell me where the dll became instable (both for RE4HD than the source engine games)...
Sure, will be glad to help. I believe that debugging and fixing these issues will have a beneficial impact on many other games (not just Source Engine-based ones)

Speaking of which, I'm about to report a number of DX9 titles that have different depth-test issues (some are minor while others are severe).
- Nerrel
-
robgrab wrote: Okay, I just tried the newest .dll files and now I can't get depth buffer with ANY settings in RE4. Things seem to be getting worse with each release (regarding RE4).
I'm having a much different problem using the latest .dll. The image is extremely washed out, and occurs everywhere, even on the title menus. I tried turning the effects off and changing the settings around, but nothing made a difference...
- robgrab
-
- thalixte
-
Topic Author
Ok, so let's be orderly. Here are the last builds ok my dlls. Can you tell me wich one are the best (RE4HD, L4D2 and source engins games) ? By advance, thks.
Reshade-3b13969c5519529642169f2fd339353e0bfd11e0.zip
Reshade-5dc247f8020f7426952b10a682d87adadbc721db.zip
Reshade-41ec1bf24bc6120696e79cd7dff39dd13ba09b75.zip
Reshade-68c989e3cf1498b04eb04006272fe37d17ace52b.zip
Reshade-307a0f7cc754214ed92f3367633623fd9b7b15b9.zip
Reshade-851bb7b6e1371d66673481a5a46ffdc310a81075.zip
Reshade-4009a4b8633b41f8aa2546468e1daade297c3cf2.zip