Manual depthbuffer flip
- OtisInf
return depth;
Replace that with
return -depth;
It seems the SSAO shader now uses the normalized buffer created by that shader in Reshade.fx instead of its own (which was the case in 1.0).
Please Log in or Create an account to join the conversation.
Oh! Thank you. I spent about 3-4 hours tweaking certain values to no success. I wouldn't have thought of thatOtisInf wrote: In Reshade.fx, at line 98 you see:
return depth;
Replace that withreturn -depth;
It seems the SSAO shader now uses the normalized buffer created by that shader in Reshade.fx instead of its own (which was the case in 1.0).
Please Log in or Create an account to join the conversation.
- Kleio420
OtisInf wrote: In Reshade.fx, at line 98 you see:
return depth;
Replace that withreturn -depth;
It seems the SSAO shader now uses the normalized buffer created by that shader in Reshade.fx instead of its own (which was the case in 1.0).
idk why they didnt just put a setting in for any games working under a upside down buffer (unity engine)
Please Log in or Create an account to join the conversation.
- Uncle Crassius
Edit: Ok, the solution to my problem rather seems to be this . After changing reshade.fx it gives out an error message, though, so I must've made some mistakes. Does that solution work with 1.1.0 at all? If yes, could anyone give more precise insturctions for a coding noob like me which lines to add and which to delete, if any?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
I'm not sure how I would do that? That doesn't seem to fit anywhere where you specify.crosire wrote: There is a difference between upside-down depth and inversed depth. This fixes the latter. The former is fixed with a "texcoord.y = 1 - texcoord.y" at the beginning of the depth storage function in ReShade.fx.
// Fullscreen Triangle Vertex Shader
void RFX_VS_PostProcess(in uint id : SV_VertexID, out float4 pos : SV_Position, out float2 texcoord : TEXCOORD)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? -2.0 : 0.0;
pos = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
}
#if RFX_InitialStorage
float4 RFX_PS_StoreColor(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
return tex2D(RFX_backbufferColor, texcoord);
}
#endif
#if RFX_DepthBufferCalc
Please Log in or Create an account to join the conversation.
- crosire
float RFX_PS_StoreDepth(in float4 position : SV_Position, in float2 texcoord : TEXCOORD0) : SV_Target
{
texcoord.y = 1 - texcoord.y;
...
Please Log in or Create an account to join the conversation.
- Janson
- Topic Author
ReShade.fx, replace the code at line 89 with this:Uncle Crassius wrote: Pushing this old thread, hope it's ok. Just adding the "-" doesn't seem to work with 1.1.0, buffer's still flipped, like upside down (in Layers of Fear if you're curious). Anything I might miss? Is it possible that it just might be the game or should it theoretically work with every flipped depth buffer? It does look like it flips normals, not the 2D ssao output itself.
Edit: Ok, the solution to my problem rather seems to be this . After changing reshade.fx it gives out an error message, though, so I must've made some mistakes. Does that solution work with 1.1.0 at all? If yes, could anyone give more precise insturctions for a coding noob like me which lines to add and which to delete, if any?
float2 source = float2(texcoord.x, 1.0-texcoord.y);
float depth = tex2D(RFX_depthColor, source).x;
It's tested on Layers of Fear and Oddworld Strangers Wrath, probably works with other games too.
Credit to OtisInf!
Please Log in or Create an account to join the conversation.
- crosire
Please Log in or Create an account to join the conversation.
- Janson
- Topic Author
crosire wrote: ReShade 2.0 will have a RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN option for this: github.com/crosire/reshade-shaders/blob/...r/ReShade/Global.cfg .
Nice, is the release date for 2.0 close?
Another thing, the linearization of the depthbuffer/value, is this a method that has to be done always a certain way or is it possible to do it several different ways? What I'm trying to get at, some games that seemingly don't show information inside the depthbuffer visualisation, is it possible that they have to be approached individually/differently to get to that information?
Please Log in or Create an account to join the conversation.
- crosire
Yes. Some games use a reverse depth buffer, some a logarithmic one, some both (i.e. GTA V), some the default (i.e. Need for Speed). So you need to play around with the "RESHADE_DEPTH_INPUT_IS_REVERSED" and "RESHADE_DEPTH_INPUT_IS_LOGARITHMIC" options (or their equivalents in 1.1).Janson wrote: Another thing, the linearization of the depthbuffer/value, is this a method that has to be done always a certain way or is it possible to do it several different ways? What I'm trying to get at, some games that seemingly don't show information inside the depthbuffer visualisation, is it possible that they have to be approached individually/differently to get to that information?
Please Log in or Create an account to join the conversation.
- NoMansReshade
EDIT:
IGNORE ME IM STUPID!!!! (found out what a preprocessor definition is)
Please Log in or Create an account to join the conversation.