Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- DO NOT EDIT
- DO NOT EDIT
- DO NOT EDIT
- I cannot stress this enough - if you don't want to break
- EVERY shader that depends on this file, do not edit.
- */
- #pragma once
- #if !defined(__RESHADE__) || __RESHADE__ < 40000
- #error "ReShade 4.0+ is required to use this header file"
- #endif
- #ifndef RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
- #define RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN 0
- #endif
- #ifndef RESHADE_DEPTH_INPUT_IS_REVERSED
- #define RESHADE_DEPTH_INPUT_IS_REVERSED 0
- #endif
- #ifndef RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
- #define RESHADE_DEPTH_INPUT_IS_LOGARITHMIC 0
- #endif
- #ifndef RESHADE_DEPTH_LINEARIZATION_FAR_PLANE
- #define RESHADE_DEPTH_LINEARIZATION_FAR_PLANE 1000.0
- #endif
- namespace qUINT
- {
- uniform float FRAME_TIME <source = "frametime";>;
- static const float2 ASPECT_RATIO = float2(1.0, BUFFER_WIDTH * BUFFER_RCP_HEIGHT);
- static const float2 PIXEL_SIZE = float2(BUFFER_RCP_WIDTH, BUFFER_RCP_HEIGHT);
- static const float2 SCREEN_SIZE = float2(BUFFER_WIDTH, BUFFER_HEIGHT);
- // Global textures and samplers
- texture BackBufferTex : COLOR;
- texture DepthBufferTex : DEPTH;
- sampler sBackBufferTex { Texture = BackBufferTex; };
- sampler sDepthBufferTex { Texture = DepthBufferTex; };
- //reusable textures for the shaders
- texture2D CommonTex0 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
- texture2D CommonTex1 { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
- sampler2D sCommonTex0 { Texture = CommonTex0; };
- sampler2D sCommonTex1 { Texture = CommonTex1; };
- // Helper functions
- float linear_depth(float2 uv)
- {
- #if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
- uv.y = 1.0 - uv.y;
- #endif
- float depth = tex2Dlod(sDepthBufferTex, float4(uv, 0, 0)).x * 1600;
- #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 nearZ = 300.0;
- const float farZ = 400.0;
- return rcp(depth * ((farZ - nearZ) / (-farZ * nearZ)) + farZ / (farZ * nearZ));
- }
- }
- // Vertex shader generating a triangle covering the entire screen
- void PostProcessVS(in uint id : SV_VertexID, out float4 vpos : SV_Position, out float2 uv : TEXCOORD)
- {
- uv.x = (id == 2) ? 2.0 : 0.0;
- uv.y = (id == 1) ? 2.0 : 0.0;
- vpos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement