Depth buffer detection modifications

  • lowenz
More
5 years 2 months ago #681 by lowenz Replied by lowenz on topic Depth buffer detection modifications
Already tested the log option, but how it works with the far plane?
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #682 by thalixte Replied by thalixte on topic Depth buffer detection modifications

lowenz wrote: Already tested the log option, but how it works with the far plane?


The way Reshade calculate the depth value rendered by the shade is the following:
float GetLinearizedDepth(float2 texcoord)
	{
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
		texcoord.y = 1.0 - texcoord.y;
#endif
		float depth = tex2Dlod(DepthBuffer, float4(texcoord, 0, 0)).x;

#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
		const float C = 0.01;
		depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
#endif
#if RESHADE_DEPTH_INPUT_IS_REVERSED
		depth = 1.0 - depth;
#endif
		const float N = 1.0;
		depth /= RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - depth * (RESHADE_DEPTH_LINEARIZATION_FAR_PLANE - N);

		return depth;
	}

So, it applies a logarithmic transformation to the initial depth value, then the depth is divided by a value calculated from the far plane and the logarithmmmic depth.
I am not a math specialist, but it seems to me that, the more tha far plan is, the more the depth values range is wide. So, lowering the far plane depth value should be a solution.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #683 by thalixte Replied by thalixte on topic Depth buffer detection modifications

+ Fable III - Depth Buffer doesn't work properly it has major with problems.
Without "multiple depthstencil replacement buffer," it flickers really bad. But when enabled this problem shows up.


Strange, indeed. Does it really run offline ?
The topic has been locked.
  • BlueSkyKnight
More
5 years 2 months ago #684 by BlueSkyKnight Replied by BlueSkyKnight on topic Depth buffer detection modifications

thalixte wrote:

+ Fable III - Depth Buffer doesn't work properly it has major with problems.
Without "multiple depthstencil replacement buffer," it flickers really bad. But when enabled this problem shows up.


Strange, indeed. Does it really run offline ?


That part is done in offline mode.
The topic has been locked.
  • CZauX
More
5 years 2 months ago #685 by CZauX Replied by CZauX on topic Depth buffer detection modifications
Hey thalixte, you've done an awesome job with this project and is probably the only googleable reference for messing around with depth buffers :lol:
If you're interested in Dolphin at all I've got an interesting case.

I've compiled rev 45d318b and tested with Dolphin 5.0-9479 under DirectX11. Been trying to get The Legend of Zelda: Collector's Edition to work with the Majoras Mask game in it. In the menu before selecting the game there is a depth buffer that shows up with DisplayDepth. When the game is selected and actually begins playing there doesn't appear to be any further detail, though there is still a depth buffer being showed by the DX11 menu. Just blank white and blue depth and normal map. RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0, reversed nor logarithmic in any combination show any detail in the depth buffer. If "Copy depth before clearing" is selected the buffer dissapears from the list until unselected. "Extended depth buffer detection" reveals no depth buffers at all.

Maybe this is just an issue where Dolphin needs to be compatible with Reshade, but thought I'd ask. The end goal would be to get a depth buffer that can atleast differentiate between the game UI and the actual 3D world. That way shaders like bloom won't effect the UI.
The topic has been locked.
  • MonarchX
More
5 years 2 months ago #686 by MonarchX Replied by MonarchX on topic Depth buffer detection modifications
Is this a D3D9-only thing? Has anyone managed to get good results with The Witcher 3 without having to disable in-game AA and without experiencing major flickering?
The topic has been locked.
  • lowenz
More
5 years 2 months ago - 5 years 2 months ago #687 by lowenz Replied by lowenz on topic Depth buffer detection modifications

MonarchX wrote: Is this a D3D9-only thing?

Yes.
Last edit: 5 years 2 months ago by lowenz.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago - 5 years 2 months ago #688 by thalixte Replied by thalixte on topic Depth buffer detection modifications
Yes, but you can speak about dx11 depth buffer detection. For TW3, i never experimented any pb with depth buffer, even with the ingame AA enabled. It works perfectly, even with the standard depth buffer detection mode.
Last edit: 5 years 2 months ago by thalixte.
The topic has been locked.
  • Uncle Crassius
More
5 years 2 months ago - 5 years 2 months ago #689 by Uncle Crassius Replied by Uncle Crassius on topic Depth buffer detection modifications
Just had a go with Vanquish again with several of the latest dlls. While they provide access to the depth buffer they mess up the shadow map in levels with directional shadows from sunlight, i.e. the shadows map's moving with the viewport. Tried several variations of ingame settings and resolutions together with with multistencil et al but it's always wonky. Might not be noticeable in indoor areas. Anyone encountered similar issues?
Last edit: 5 years 2 months ago by Uncle Crassius.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #690 by thalixte Replied by thalixte on topic Depth buffer detection modifications

Uncle Crassius wrote: Just had a go with Vanquish again with several of the latest dlls. While they provide access to the depth buffer they mess up the shadow map in levels with directional shadows from sunlight, i.e. the shadows map's moving with the viewport. Tried several variations of ingame settings and resolutions together with with multistencil et al but it's always wonky. Might not be noticeable in indoor areas. Anyone encountered similar issues?


Interesting... Would it be possible for you to send me the game saves ?
The topic has been locked.
  • Uncle Crassius
More
5 years 2 months ago - 5 years 2 months ago #691 by Uncle Crassius Replied by Uncle Crassius on topic Depth buffer detection modifications

thalixte wrote: Interesting... Would it be possible for you to send me the game saves ?


Sure. This should be the correct file. drive.google.com/file/d/1c2k57j_VSbn9JpZ...5Pd/view?usp=sharing
Goes into <Steam-folder>\userdata\<user-id>\460810\remote\ according to pcgamingwiki .
Last edit: 5 years 2 months ago by Uncle Crassius.
The topic has been locked.
  • lowenz
More
5 years 2 months ago - 5 years 2 months ago #692 by lowenz Replied by lowenz on topic Depth buffer detection modifications
It seems that RS 4.1.1 (official / compiled) can't retrieve the DB in D3D11 in DXHRDC, no matter the chosen options.

Can you check thalixte?
Last edit: 5 years 2 months ago by lowenz.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #693 by thalixte Replied by thalixte on topic Depth buffer detection modifications

Uncle Crassius wrote:

thalixte wrote: Interesting... Would it be possible for you to send me the game saves ?


Sure. This should be the correct file. drive.google.com/file/d/1c2k57j_VSbn9JpZ...5Pd/view?usp=sharing
Goes into <Steam-folder>\userdata\<user-id>\460810\remote\ according to pcgamingwiki .


This one should fix artefacts in Vanquish, BUT it removes the shadows....

d3d9_32bits.zip
The following user(s) said Thank You: Uncle Crassius
The topic has been locked.
  • Uncle Crassius
More
5 years 2 months ago #694 by Uncle Crassius Replied by Uncle Crassius on topic Depth buffer detection modifications
Well, better than effed up shadows for now. Thanks a lot.
The topic has been locked.
  • lowenz
More
5 years 2 months ago - 5 years 2 months ago #695 by lowenz Replied by lowenz on topic Depth buffer detection modifications

lowenz wrote: It seems that RS 4.1.1 (official / compiled) can't retrieve the DB in D3D11 in DXHRDC, no matter the chosen options.

Can you check thalixte?

Up :p

(MXAO is SO important in Human Revolution or you get that totally flat-shading feeling, even using the original - imho really bad - SSAO!)
Last edit: 5 years 2 months ago by lowenz.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #696 by thalixte Replied by thalixte on topic Depth buffer detection modifications

lowenz wrote:

lowenz wrote: It seems that RS 4.1.1 (official / compiled) can't retrieve the DB in D3D11 in DXHRDC, no matter the chosen options.

Can you check thalixte?

Up :p

(MXAO is SO important in Human Revolution or you get that totally flat-shading feeling, even using the original - imho really bad - SSAO!)


Yes, i totally agree, but i am very busy nowadays, sorry. I did not have the time to test on Dolphin (@CZauX's request). I already have Vanquish, so it was easy to test, but i removed Deus Ex since a long time.
The topic has been locked.
  • GrijzePilion
More
5 years 2 months ago - 5 years 2 months ago #697 by GrijzePilion Replied by GrijzePilion on topic Depth buffer detection modifications
Hey, I did a reinstall of my Reshade after I updated to version 4.1.1 to solve some issues I was having with 3.1.1. Unfortunately the new version only made them worse and there were no longer any buffer detection options under the settings menu. I've now reverted to the old version, but the tab entitled Buffer Detection is still nowhere to be found. I'm also missing a large number of options under the MXAO.fx configuration.

Could this have something to do with your modification?

EDIT: upon further investigation I was running Reshade version 3.1.2.72 when I had this tab and my Buffer Detection settings were at Before Clearing / First / 2. I was still seeing glitching and various the various other viewport issues I've been having with the depth buffer but these were subtle enough for my game to be playable. It does seem like the game is decidedly NOT playable using Reshade's default depth buffer clearing settings, since the depth buffer will consistently alternate between failing to be retrieved entirely, and rendering all game geometry inside out and upside down inside the aforementioned 1024x512 window.

I don't know if you've modified your detection methods since you first linked me to this thread but the modified DLL I got out of this thread (before all the links died) was by far the least broken way of doing things I've seen under either Reshade 3 or 4.

I'm currently looking into when exactly I first started having any depth issues under Reshade 2.0.3 and whether it coincides with a GPU driver update, a DX9 update, a major change in game data.....anything, really. Amazing how such a little thing can thoroughly ruin your day-to-day enjoyment of a game you've played weekly for 8 years.
Last edit: 5 years 2 months ago by GrijzePilion.
The topic has been locked.
  • thalixte
  • Topic Author
More
5 years 2 months ago #698 by thalixte Replied by thalixte on topic Depth buffer detection modifications

GrijzePilion wrote: Hey, I did a reinstall of my Reshade after I updated to version 4.1.1 to solve some issues I was having with 3.1.1. Unfortunately the new version only made them worse and there were no longer any buffer detection options under the settings menu. I've now reverted to the old version, but the tab entitled Buffer Detection is still nowhere to be found. I'm also missing a large number of options under the MXAO.fx configuration.

Could this have something to do with your modification?

EDIT: upon further investigation I was running Reshade version 3.1.2.72 when I had this tab and my Buffer Detection settings were at Before Clearing / First / 2. I was still seeing glitching and various the various other viewport issues I've been having with the depth buffer but these were subtle enough for my game to be playable. It does seem like the game is decidedly NOT playable using Reshade's default depth buffer clearing settings, since the depth buffer will consistently alternate between failing to be retrieved entirely, and rendering all game geometry inside out and upside down inside the aforementioned 1024x512 window.

I don't know if you've modified your detection methods since you first linked me to this thread but the modified DLL I got out of this thread (before all the links died) was by far the least broken way of doing things I've seen under either Reshade 3 or 4.

I'm currently looking into when exactly I first started having any depth issues under Reshade 2.0.3 and whether it coincides with a GPU driver update, a DX9 update, a major change in game data.....anything, really. Amazing how such a little thing can thoroughly ruin your day-to-day enjoyment of a game you've played weekly for 8 years.


No, i did not make any modification that was commited for the 4.1.1 Reshade release. Normally, the Reshade official release does not embed any of my modifications for d3d9. It just have the dx10 and dx11 modifications.
The topic has been locked.
  • GrijzePilion
More
5 years 2 months ago #699 by GrijzePilion Replied by GrijzePilion on topic Depth buffer detection modifications
Okay, so I've gone back to the older version but I seem to be lacking your Depth Buffer Detection options.....and I think the links in this thread are dead. Can you send it to me for version 3?
The topic has been locked.
  • BOTLester
More
5 years 2 months ago #700 by BOTLester Replied by BOTLester on topic Depth buffer detection modifications
Hey, I have problem with depth buffer in several dx9 games (STALKER, Fallout New Vegas). As far as I remember it didn't work in Fallout 4 too so probably it is also problem with dx11. I tried thalixte custom dlls for dx9, but it still doesn't work, the only thing I could find in logs about depth buffer was this : "Failed to retrieve texture from depth surface! HRESULT is '0x80004002'."
Depth buffer is just empty.

ENB does have an access to depth buffer in those games, so i guess it's a problem with ReShade :/
The topic has been locked.
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.