Pseudo depth buffer missing from 2.0?
- Aelius Maximus
- Topic Author
Thanks.
Please Log in or Create an account to join the conversation.
- brussell
ReShade.fx
...
// Global Textures and Samplers
texture BackBufferTex : COLOR;
texture DepthBufferTex : DEPTH;
texture OriginalColorTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
sampler BackBuffer { Texture = BackBufferTex; };
sampler OriginalColor { Texture = OriginalColorTex; };
sampler OriginalDepth { Texture = DepthBufferTex; };
#if RESHADE_DEPTH_CALCULATION
texture DepthTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R32F; };
sampler DepthTexSampler { Texture = DepthTex; };
#endif
#if RESHADE_PSEUDODOF
texture PseudoDofTex < source = "ReShade/Profiles/Default/Textures/dMask.png"; > { Width = 1024; Height = 1024; MipLevels = 1; Format = RGBA8; };
sampler PseudoDofSampler { Texture = PseudoDofTex; };
#endif
// Full-screen triangle vertex shader
void 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);
}
// Color and depth buffer copy and linearization shaders
float4 PS_CopyBackBuffer(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
return tex2D(BackBuffer, texcoord);
}
#if RESHADE_DEPTH_CALCULATION
void PS_Depth_Calculation(float4 vpos : SV_Position, float2 texcoord : TEXCOORD0, out float depth : SV_Target)
{
#if RESHADE_PSEUDODOF
depth tex2D(PseudoDofSampler, texcoord).x;
#else
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
texcoord.y = 1.0 - texcoord.y;
#endif
depth = tex2D(OriginalDepth, texcoord).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);
#endif
}
#endif
}
...
ReShade/Profiles/Default/Global.cfg
...
//>Depth Settings<\\
#define RESHADE_DEPTH_CALCULATION 1 //[0:1] //-Set this to 0 if run an application that does not allow depth buffer access or you use no depth dependent effects and want some additional fps.
#define RESHADE_DEPTH_LINEARIZATION_FAR_PLANE 1000.0 //[0.0:100000.0] //-The far clipping plane distance.
#define RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN 0 //[0:1] //-Set this to one for games where the depth buffer is upside down.
#define RESHADE_DEPTH_INPUT_IS_REVERSED 0 //[0:1] //-Set this to one for games using a reversed depth buffer.
#define RESHADE_DEPTH_INPUT_IS_LOGARITHMIC 0 //[0:1] //-Set this to one for games using a logarithmic depth buffer.
#define RESHADE_PSEUDODOF 1 //[0:1] //-To use or configure depth shader without acces to depth buffer.
Please Log in or Create an account to join the conversation.
- Aelius Maximus
- Topic Author
ReShade.fx(111, 32): error X3004: undeclared identifier 'BackBufferTex'
Perhaps an old definition that is no longer supported? I'm not too sure, hopefully there will be no more after that is corrected
Thank you again
Please Log in or Create an account to join the conversation.
- BlueSkyKnight
Aelius Maximus wrote: Thanks for going to the effort of porting the code forward from 1.0, So close as well, there is just one error code which is preventing it from compiling
ReShade.fx(111, 32): error X3004: undeclared identifier 'BackBufferTex'
Perhaps an old definition that is no longer supported? I'm not too sure, hopefully there will be no more after that is corrected
Thank you again
You can set your own.
texture BackBufferTex : COLOR;
sampler BackBuffer
{
Texture = BackBufferTex;
};
Just change the Name BackBuffer to "whateveryouwant" or Just use BackBuffer
Please Log in or Create an account to join the conversation.
- brussell
Copy ReShade/BasicFX/Textures/dMask.png (ReShade 1.0) to ReShade/dMask.png and use the following files:
ReShade.fx
#if !defined(__RESHADE__) || __RESHADE__ < 20000
#error "ReShade 2.0+ is required to use these shaders"
#endif
#define STR(value) #value
#define STE(value) STR(value)
#include "ReShade\KeyCodes.h"
// Global Settings
#if exists(STE(ReShade/Profiles/__APPLICATION_NAME__/Global.cfg))
#include STE(ReShade/Profiles/__APPLICATION_NAME__/Global.cfg)
#else
#warning "Could not find application profile, falling back to default"
#include "ReShade/Profiles/Default/Global.cfg"
#endif
#pragma reshade screenshot_key RESHADE_SCREENSHOT_KEY
#pragma reshade screenshot_format RESHADE_SCREENSHOT_FORMAT
#if RESHADE_SHOW_FPS
#pragma reshade showfps
#endif
#if RESHADE_SHOW_CLOCK
#pragma reshade showclock
#endif
#if RESHADE_SHOW_STATISTICS
#pragma reshade showstatistics
#endif
#if RESHADE_SHOW_TOGGLE_MESSAGES
#pragma reshade showtogglemessage
#endif
namespace ReShade
{
// Global Variables
static const float AspectRatio = BUFFER_WIDTH * BUFFER_RCP_HEIGHT;
static const float2 PixelSize = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
static const float2 ScreenSize = float2(BUFFER_WIDTH, BUFFER_HEIGHT);
uniform float Timer < source = "timer"; >;
uniform float FrameTime < source = "frametime"; >;
uniform float2 MouseCoords < source = "mousepoint"; >;
// Global Textures and Samplers
texture BackBufferTex : COLOR;
texture DepthBufferTex : DEPTH;
texture OriginalColorTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
#if RESHADE_DEPTH_LINEARIZATION
texture LinearizedDepthTex { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R32F; };
#else
texture LinearizedDepthTex : DEPTH;
#endif
sampler BackBuffer { Texture = BackBufferTex; };
sampler OriginalColor { Texture = OriginalColorTex; };
sampler OriginalDepth { Texture = DepthBufferTex; };
sampler LinearizedDepth { Texture = LinearizedDepthTex; };
#if RESHADE_PSEUDODOF_ENABLE
texture PseudoDOFTex < source = "ReShade/dMask.png"; > { Width = 1024; Height = 1024; Format = R8; };
sampler PseudoDOF
{
Texture = PseudoDOFTex;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Clamp;
AddressV = Clamp;
};
#endif
// Full-screen triangle vertex shader
void 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);
}
// Color and depth buffer copy and linearization shaders
float4 PS_CopyBackBuffer(float4 vpos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
return tex2D(BackBuffer, texcoord);
}
#if RESHADE_DEPTH_LINEARIZATION
void PS_DepthLinearization(float4 vpos : SV_Position, float2 texcoord : TEXCOORD0, out float depth : SV_Target)
{
#if RESHADE_PSEUDODOF_ENABLE
depth = tex2D(PseudoDOF, texcoord).x;
#else
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
texcoord.y = 1.0 - texcoord.y;
#endif
depth = tex2D(OriginalDepth, texcoord).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);
#endif
}
#endif
}
technique Setup < enabled = true; >
{
pass ColorBackup
{
VertexShader = ReShade::VS_PostProcess;
PixelShader = ReShade::PS_CopyBackBuffer;
RenderTarget = ReShade::OriginalColorTex;
}
#if RESHADE_DEPTH_LINEARIZATION
pass DepthLinearization
{
VertexShader = ReShade::VS_PostProcess;
PixelShader = ReShade::PS_DepthLinearization;
RenderTarget = ReShade::LinearizedDepthTex;
}
#endif
}
// Preset Settings
#if !defined(RESHADE_PRESET) || !exists(STE(ReShade/Presets/RESHADE_PRESET))
#warning "Could not find preset, falling back to default"
#undef RESHADE_PRESET
#define RESHADE_PRESET Default
#endif
#define EFFECT(author, name) STE(ReShade/Shaders/author/name.fx)
#define EFFECT_CONFIG(author) STE(ReShade/Presets/RESHADE_PRESET/Shaders_by_##author.cfg)
#define EFFECT_CONFIG_UNDEF(author) STE(ReShade/Shaders/author.undef)
#include STE(ReShade/Presets/RESHADE_PRESET/Pipeline.cfg)
ReShade/Profiles/Default/Global.cfg
////----------//
///**Global**///
//----------////
#define RESHADE_PRESET Default
//>User<\\
#define RESHADE_START_ENABLED 1 //[0:1] //-Controls whether to start with effects on or off.
#define RESHADE_SCREENSHOT_KEY VK_SNAPSHOT //[undef] //-Sets the key for taking screenshots. Default is the PrintScreen key.
#define RESHADE_SCREENSHOT_FORMAT png //[undef] //-Sets the screenshot image format.
#define RESHADE_TOGGLE_KEY VK_SCROLL //[undef] //-Sets the global key to toggle effects on and off.
//>User Interface<\\
#define RESHADE_SHOW_FPS 0 //[0:1] //-Controls the display of a simple FPS counter.
#define RESHADE_SHOW_CLOCK 0 //[0:1] //-Controls the display of a simple realtime clock.
#define RESHADE_SHOW_STATISTICS 0 //[0:1] //-Controls the display of the detailed developer statistics.
#define RESHADE_SHOW_TOGGLE_MESSAGES 0 //[0:1] //-Controls the display of an info message when the toggle key is pressed.
//>Depth Settings<\\
#define RESHADE_DEPTH_LINEARIZATION 1 //[0:1] //-Set this to zero for games without depth buffer access or if you do not use any depth dependent effects.
#define RESHADE_DEPTH_LINEARIZATION_FAR_PLANE 1000.0 //[0.0:100000.0] //-The far clipping plane distance.
#define RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN 0 //[0:1] //-Set this to one for games where the depth buffer is upside down.
#define RESHADE_DEPTH_INPUT_IS_REVERSED 0 //[0:1] //-Set this to one for games using a reversed depth buffer.
#define RESHADE_DEPTH_INPUT_IS_LOGARITHMIC 0 //[0:1] //-Set this to one for games using a logarithmic depth buffer.
#define RESHADE_PSEUDODOF_ENABLE 1 //[0:1] //-Enable PseudoDof
Please Log in or Create an account to join the conversation.
- Aelius Maximus
- Topic Author
Please Log in or Create an account to join the conversation.