dep/reshadefx: Update to 7bdfb03
This commit is contained in:
427
data/resources/shaders/reshade/Shaders/DisplayDepth.fx
Normal file
427
data/resources/shaders/reshade/Shaders/DisplayDepth.fx
Normal file
@ -0,0 +1,427 @@
|
||||
/*
|
||||
DisplayDepth by CeeJay.dk (with many updates and additions by the Reshade community)
|
||||
|
||||
Visualizes the depth buffer. The distance of pixels determine their brightness.
|
||||
Close objects are dark. Far away objects are bright.
|
||||
Use this to configure the depth input preprocessor definitions (RESHADE_DEPTH_INPUT_*).
|
||||
*/
|
||||
|
||||
#include "ReShade.fxh"
|
||||
|
||||
// -- Basic options --
|
||||
#if RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
|
||||
#define TEXT_UPSIDE_DOWN "1"
|
||||
#define TEXT_UPSIDE_DOWN_ALTER "0"
|
||||
#else
|
||||
#define TEXT_UPSIDE_DOWN "0"
|
||||
#define TEXT_UPSIDE_DOWN_ALTER "1"
|
||||
#endif
|
||||
#if RESHADE_DEPTH_INPUT_IS_REVERSED
|
||||
#define TEXT_REVERSED "1"
|
||||
#define TEXT_REVERSED_ALTER "0"
|
||||
#else
|
||||
#define TEXT_REVERSED "0"
|
||||
#define TEXT_REVERSED_ALTER "1"
|
||||
#endif
|
||||
#if RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
|
||||
#define TEXT_LOGARITHMIC "1"
|
||||
#define TEXT_LOGARITHMIC_ALTER "0"
|
||||
#else
|
||||
#define TEXT_LOGARITHMIC "0"
|
||||
#define TEXT_LOGARITHMIC_ALTER "1"
|
||||
#endif
|
||||
|
||||
// "ui_text" was introduced in ReShade 4.5, so cannot show instructions in older versions
|
||||
|
||||
uniform int iUIPresentType <
|
||||
ui_label = "Present type";
|
||||
ui_label_ja_jp = "画面効果";
|
||||
ui_type = "combo";
|
||||
ui_items = "Depth map\0Normal map\0Show both (Vertical 50/50)\0";
|
||||
ui_items_ja_jp = "深度マップ\0法線マップ\0両方を表示 (左右分割)\0";
|
||||
#if __RESHADE__ < 40500
|
||||
ui_tooltip =
|
||||
#else
|
||||
ui_text =
|
||||
#endif
|
||||
"The right settings need to be set in the dialog that opens after clicking the \"Edit global preprocessor definitions\" button above.\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN is currently set to " TEXT_UPSIDE_DOWN ".\n"
|
||||
"If the Depth map is shown upside down set it to " TEXT_UPSIDE_DOWN_ALTER ".\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_REVERSED is currently set to " TEXT_REVERSED ".\n"
|
||||
"If close objects in the Depth map are bright and far ones are dark set it to " TEXT_REVERSED_ALTER ".\n"
|
||||
"Also try this if you can see the normals, but the depth view is all black.\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_LOGARITHMIC is currently set to " TEXT_LOGARITHMIC ".\n"
|
||||
"If the Normal map has banding artifacts (extra stripes) set it to " TEXT_LOGARITHMIC_ALTER ".";
|
||||
ui_text_ja_jp =
|
||||
#if ADDON_ADJUST_DEPTH
|
||||
"Adjust Depthアドオンのインストールを検出しました。\n"
|
||||
"'設定に保存して反映する'ボタンをクリックすると、このエフェクトで調節した全ての変数が共通設定に反映されます。\n"
|
||||
"または、上の'プリプロセッサの定義を編集'ボタンをクリックした後に開くダイアログで直接編集する事もできます。";
|
||||
#else
|
||||
"調節が終わったら、上の'プリプロセッサの定義を編集'ボタンをクリックした後に開くダイアログに入力する必要があります。\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWNは現在" TEXT_UPSIDE_DOWN "に設定されています。\n"
|
||||
"深度マップが上下逆さまに表示されている場合は" TEXT_UPSIDE_DOWN_ALTER "に変更して下さい。\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_REVERSEDは現在" TEXT_REVERSED "に設定されています。\n"
|
||||
"画面効果が深度マップのとき、近くの形状がより白く、遠くの形状がより黒い場合は" TEXT_REVERSED_ALTER "に変更して下さい。\n"
|
||||
"また、法線マップで形が判別出来るが、深度マップが真っ暗に見えるという場合も、この設定の変更を試して下さい。\n"
|
||||
"\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_LOGARITHMICは現在" TEXT_LOGARITHMIC "に設定されています。\n"
|
||||
"画面効果に実際のレンダリングと合致しない縞模様がある場合は" TEXT_LOGARITHMIC_ALTER "に変更して下さい。";
|
||||
#endif
|
||||
ui_tooltip_ja_jp =
|
||||
"'深度マップ'は、形状の遠近を白黒で表現します。正しい見え方では、近くの形状ほど黒く、遠くの形状ほど白くなります。\n"
|
||||
"'法線マップ'は、形状を滑らかに表現します。正しい見え方では、全体的に青緑風で、地平線を見たときに地面が緑掛かった色合いになります。\n"
|
||||
"'両方を表示 (左右分割)'が選択された場合は、左に法線マップ、右に深度マップを表示します。";
|
||||
> = 2;
|
||||
|
||||
uniform bool bUIShowOffset <
|
||||
ui_label = "Blend Depth map into the image (to help with finding the right offset)";
|
||||
ui_label_ja_jp = "透かし比較";
|
||||
ui_tooltip_ja_jp = "補正作業を支援するために、画面効果を半透過で適用します。";
|
||||
> = false;
|
||||
|
||||
uniform bool bUIUseLivePreview <
|
||||
ui_category = "Preview settings";
|
||||
ui_category_ja_jp = "基本的な補正";
|
||||
#if __RESHADE__ <= 50902
|
||||
ui_category_closed = true;
|
||||
#elif !ADDON_ADJUST_DEPTH
|
||||
ui_category_toggle = true;
|
||||
#endif
|
||||
ui_label = "Show live preview and ignore preprocessor definitions";
|
||||
ui_label_ja_jp = "プリプロセッサの定義を無視 (補正プレビューをオン)";
|
||||
ui_tooltip = "Enable this to preview with the current preset settings instead of the global preprocessor settings.";
|
||||
ui_tooltip_ja_jp =
|
||||
"共通設定に保存されたプリプロセッサの定義ではなく、これより下のプレビュー設定を使用するには、これを有効にします。\n"
|
||||
#if ADDON_ADJUST_DEPTH
|
||||
"設定の準備が出来たら、'設定に保存して反映する'ボタンをクリックしてから、このチェックボックスをオフにして下さい。"
|
||||
#else
|
||||
"設定の準備が出来たら、上の'プリプロセッサの定義を編集'ボタンをクリックした後に開くダイアログに入力して下さい。"
|
||||
#endif
|
||||
"\n\n"
|
||||
"プレビューをオンにした場合と比較して画面効果がまったく同じになれば、正しく設定が反映されています。";
|
||||
> = false;
|
||||
|
||||
#if __RESHADE__ <= 50902
|
||||
uniform int iUIUpsideDown <
|
||||
#else
|
||||
uniform bool iUIUpsideDown <
|
||||
#endif
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Upside Down";
|
||||
ui_label_ja_jp = "深度バッファの上下反転を修正";
|
||||
#if __RESHADE__ <= 50902
|
||||
ui_type = "combo";
|
||||
ui_items = "Off\0On\0";
|
||||
#endif
|
||||
ui_text_ja_jp =
|
||||
"\n"
|
||||
#if ADDON_ADJUST_DEPTH
|
||||
"項目にカーソルを合わせると、設定が必要な状況の説明が表示されます。"
|
||||
#else
|
||||
"項目にカーソルを合わせると、設定が必要な状況の説明と、プリプロセッサの定義が表示されます。"
|
||||
#endif
|
||||
;
|
||||
ui_tooltip_ja_jp =
|
||||
"深度マップが上下逆さまに表示されている場合は変更して下さい。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=値\n"
|
||||
"定義値は次の通りです。オンの場合は1、オフの場合は0を指定して下さい。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=1\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN=0"
|
||||
#endif
|
||||
;
|
||||
> = RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN;
|
||||
|
||||
#if __RESHADE__ <= 50902
|
||||
uniform int iUIReversed <
|
||||
#else
|
||||
uniform bool iUIReversed <
|
||||
#endif
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Reversed";
|
||||
ui_label_ja_jp = "深度バッファの奥行反転を修正";
|
||||
#if __RESHADE__ <= 50902
|
||||
ui_type = "combo";
|
||||
ui_items = "Off\0On\0";
|
||||
#endif
|
||||
ui_tooltip_ja_jp =
|
||||
"画面効果が深度マップのとき、近くの形状が明るく、遠くの形状が暗い場合は変更して下さい。\n"
|
||||
"また、法線マップで形が判別出来るが、深度マップが真っ暗に見えるという場合も、この設定の変更を試して下さい。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_REVERSED=値\n"
|
||||
"定義値は次の通りです。オンの場合は1、オフの場合は0を指定して下さい。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_REVERSED=1\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_REVERSED=0"
|
||||
#endif
|
||||
;
|
||||
> = RESHADE_DEPTH_INPUT_IS_REVERSED;
|
||||
|
||||
#if __RESHADE__ <= 50902
|
||||
uniform int iUILogarithmic <
|
||||
#else
|
||||
uniform bool iUILogarithmic <
|
||||
#endif
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Logarithmic";
|
||||
ui_label_ja_jp = "深度バッファを対数分布として扱うように修正";
|
||||
#if __RESHADE__ <= 50902
|
||||
ui_type = "combo";
|
||||
ui_items = "Off\0On\0";
|
||||
#endif
|
||||
ui_tooltip = "Change this setting if the displayed surface normals have stripes in them.";
|
||||
ui_tooltip_ja_jp =
|
||||
"画面効果に実際のゲーム画面と合致しない縞模様がある場合は変更して下さい。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=値\n"
|
||||
"定義値は次の通りです。オンの場合は1、オフの場合は0を指定して下さい。\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=1\n"
|
||||
"RESHADE_DEPTH_INPUT_IS_LOGARITHMIC=0"
|
||||
#endif
|
||||
;
|
||||
> = RESHADE_DEPTH_INPUT_IS_LOGARITHMIC;
|
||||
|
||||
// -- Advanced options --
|
||||
|
||||
uniform float2 fUIScale <
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Scale";
|
||||
ui_label_ja_jp = "拡大率";
|
||||
ui_type = "drag";
|
||||
ui_text =
|
||||
"\n"
|
||||
" * Advanced options\n"
|
||||
"\n"
|
||||
"The following settings also need to be set using \"Edit global preprocessor definitions\" above in order to take effect.\n"
|
||||
"You can preview how they will affect the Depth map using the controls below.\n"
|
||||
"\n"
|
||||
"It is rarely necessary to change these though, as their defaults fit almost all games.\n\n";
|
||||
ui_text_ja_jp =
|
||||
"\n"
|
||||
" * その他の補正 (不定形またはその他)\n"
|
||||
"\n"
|
||||
"これより下は、深度バッファが不定形など、特別なケース向けの設定です。\n"
|
||||
"通常はこれより上の'基本的な補正'のみでほとんどのゲームに適合します。\n"
|
||||
"また、これらの設定は画質の向上にはまったく役に立ちません。\n\n";
|
||||
ui_tooltip =
|
||||
"Best use 'Present type'->'Depth map' and enable 'Offset' in the options below to set the scale.\n"
|
||||
"Use these values for:\nRESHADE_DEPTH_INPUT_X_SCALE=<left value>\nRESHADE_DEPTH_INPUT_Y_SCALE=<right value>\n"
|
||||
"\n"
|
||||
"If you know the right resolution of the games depth buffer then this scale value is simply the ratio\n"
|
||||
"between the correct resolution and the resolution Reshade thinks it is.\n"
|
||||
"For example:\n"
|
||||
"If it thinks the resolution is 1920 x 1080, but it's really 1280 x 720 then the right scale is (1.5 , 1.5)\n"
|
||||
"because 1920 / 1280 is 1.5 and 1080 / 720 is also 1.5, so 1.5 is the right scale for both the x and the y";
|
||||
ui_tooltip_ja_jp =
|
||||
"深度バッファの解像度がクライアント解像度と異なる場合に変更して下さい。\n"
|
||||
"このスケール値は、深度バッファの解像度とクライアント解像度との単純な比率になります。\n"
|
||||
"深度バッファの解像度が1280×720でクライアント解像度が1920×1080の場合、横の比率が1920÷1280、縦の比率が1080÷720となります。\n"
|
||||
"計算した結果を設定すると、値はそれぞれX_SCALE=1.5、Y_SCALE=1.5となります。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_INPUT_X_SCALE=横の値\n"
|
||||
"RESHADE_DEPTH_INPUT_Y_SCALE=縦の値\n"
|
||||
"定義値は次の通りです。横の値はX_SCALE、縦の値はY_SCALEに指定して下さい。\n"
|
||||
"RESHADE_DEPTH_INPUT_X_SCALE=1.0\n"
|
||||
"RESHADE_DEPTH_INPUT_Y_SCALE=1.0"
|
||||
#endif
|
||||
;
|
||||
ui_min = 0.0; ui_max = 2.0;
|
||||
ui_step = 0.001;
|
||||
> = float2(RESHADE_DEPTH_INPUT_X_SCALE, RESHADE_DEPTH_INPUT_Y_SCALE);
|
||||
|
||||
uniform int2 iUIOffset <
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Offset";
|
||||
ui_label_ja_jp = "位置オフセット";
|
||||
ui_type = "slider";
|
||||
ui_tooltip =
|
||||
"Best use 'Present type'->'Depth map' and enable 'Offset' in the options below to set the offset in pixels.\n"
|
||||
"Use these values for:\nRESHADE_DEPTH_INPUT_X_PIXEL_OFFSET=<left value>\nRESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET=<right value>";
|
||||
ui_tooltip_ja_jp =
|
||||
"深度バッファにレンダリングされた物体の形状が画面効果と重なり合っていない場合に変更して下さい。\n"
|
||||
"この値は、ピクセル単位で指定します。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET=横の値\n"
|
||||
"RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET=縦の値\n"
|
||||
"定義値は次の通りです。横の値はX_PIXEL_OFFSET、縦の値はY_PIXEL_OFFSETに指定して下さい。\n"
|
||||
"RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET=0.0\n"
|
||||
"RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET=0.0"
|
||||
#endif
|
||||
;
|
||||
ui_min = -BUFFER_SCREEN_SIZE;
|
||||
ui_max = BUFFER_SCREEN_SIZE;
|
||||
ui_step = 1;
|
||||
> = int2(RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET, RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET);
|
||||
|
||||
uniform float fUIFarPlane <
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Far Plane";
|
||||
ui_label_ja_jp = "遠点距離";
|
||||
ui_type = "drag";
|
||||
ui_tooltip =
|
||||
"RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=<value>\n"
|
||||
"Changing this value is not necessary in most cases.";
|
||||
ui_tooltip_ja_jp =
|
||||
"深度マップの色合いが距離感と合致しない、法線マップの表面が平面に見える、などの場合に変更して下さい。\n"
|
||||
"遠点距離を1000に設定すると、ゲームの描画距離が1000メートルであると見なします。\n\n"
|
||||
"このプレビュー画面はあくまでプレビューであり、ほとんどの場合、深度バッファは深度マップの色数より遥かに高い精度で表現されています。\n"
|
||||
"例えば、10m前後の距離の形状が純粋な黒に見えるからという理由で値を変更しないで下さい。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=値\n"
|
||||
"定義値は次の通りです。\n"
|
||||
"RESHADE_DEPTH_LINEARIZATION_FAR_PLANE=1000.0"
|
||||
#endif
|
||||
;
|
||||
ui_min = 0.0; ui_max = 1000.0;
|
||||
ui_step = 0.1;
|
||||
> = RESHADE_DEPTH_LINEARIZATION_FAR_PLANE;
|
||||
|
||||
uniform float fUIDepthMultiplier <
|
||||
ui_category = "Preview settings";
|
||||
ui_label = "Multiplier";
|
||||
ui_label_ja_jp = "深度乗数";
|
||||
ui_type = "drag";
|
||||
ui_tooltip = "RESHADE_DEPTH_MULTIPLIER=<value>";
|
||||
ui_tooltip_ja_jp =
|
||||
"特定のエミュレータソフトウェアにおける深度バッファを修正するため、特別に追加された変数です。\n"
|
||||
"この値は僅かな変更でも計算式を破壊するため、設定すべき値を知らない場合は変更しないで下さい。"
|
||||
#if !ADDON_ADJUST_DEPTH
|
||||
"\n\n"
|
||||
"定義名は次の通りです。文字は完全に一致する必要があり、半角大文字の英字とアンダーバーを用いなければなりません。\n"
|
||||
"RESHADE_DEPTH_MULTIPLIER=値\n"
|
||||
"定義値は次の通りです。\n"
|
||||
"RESHADE_DEPTH_MULTIPLIER=1.0"
|
||||
#endif
|
||||
;
|
||||
ui_min = 0.0; ui_max = 1000.0;
|
||||
ui_step = 0.001;
|
||||
> = RESHADE_DEPTH_MULTIPLIER;
|
||||
|
||||
float GetLinearizedDepth(float2 texcoord)
|
||||
{
|
||||
if (!bUIUseLivePreview)
|
||||
{
|
||||
return ReShade::GetLinearizedDepth(texcoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iUIUpsideDown) // RESHADE_DEPTH_INPUT_IS_UPSIDE_DOWN
|
||||
texcoord.y = 1.0 - texcoord.y;
|
||||
|
||||
texcoord.x /= fUIScale.x; // RESHADE_DEPTH_INPUT_X_SCALE
|
||||
texcoord.y /= fUIScale.y; // RESHADE_DEPTH_INPUT_Y_SCALE
|
||||
texcoord.x -= iUIOffset.x * BUFFER_RCP_WIDTH; // RESHADE_DEPTH_INPUT_X_PIXEL_OFFSET
|
||||
texcoord.y += iUIOffset.y * BUFFER_RCP_HEIGHT; // RESHADE_DEPTH_INPUT_Y_PIXEL_OFFSET
|
||||
|
||||
float depth = tex2Dlod(ReShade::DepthBuffer, float4(texcoord, 0, 0)).x * fUIDepthMultiplier;
|
||||
|
||||
const float C = 0.01;
|
||||
if (iUILogarithmic) // RESHADE_DEPTH_INPUT_IS_LOGARITHMIC
|
||||
depth = (exp(depth * log(C + 1.0)) - 1.0) / C;
|
||||
|
||||
if (iUIReversed) // RESHADE_DEPTH_INPUT_IS_REVERSED
|
||||
depth = 1.0 - depth;
|
||||
|
||||
const float N = 1.0;
|
||||
depth /= fUIFarPlane - depth * (fUIFarPlane - N);
|
||||
|
||||
return depth;
|
||||
}
|
||||
}
|
||||
|
||||
float3 GetScreenSpaceNormal(float2 texcoord)
|
||||
{
|
||||
float3 offset = float3(BUFFER_PIXEL_SIZE, 0.0);
|
||||
float2 posCenter = texcoord.xy;
|
||||
float2 posNorth = posCenter - offset.zy;
|
||||
float2 posEast = posCenter + offset.xz;
|
||||
|
||||
float3 vertCenter = float3(posCenter - 0.5, 1) * GetLinearizedDepth(posCenter);
|
||||
float3 vertNorth = float3(posNorth - 0.5, 1) * GetLinearizedDepth(posNorth);
|
||||
float3 vertEast = float3(posEast - 0.5, 1) * GetLinearizedDepth(posEast);
|
||||
|
||||
return normalize(cross(vertCenter - vertNorth, vertCenter - vertEast)) * 0.5 + 0.5;
|
||||
}
|
||||
|
||||
void PS_DisplayDepth(in float4 position : SV_Position, in float2 texcoord : TEXCOORD, out float3 color : SV_Target)
|
||||
{
|
||||
float3 depth = GetLinearizedDepth(texcoord).xxx;
|
||||
float3 normal = GetScreenSpaceNormal(texcoord);
|
||||
|
||||
// Ordered dithering
|
||||
#if 1
|
||||
const float dither_bit = 8.0; // Number of bits per channel. Should be 8 for most monitors.
|
||||
// Calculate grid position
|
||||
float grid_position = frac(dot(texcoord, (BUFFER_SCREEN_SIZE * float2(1.0 / 16.0, 10.0 / 36.0)) + 0.25));
|
||||
// Calculate how big the shift should be
|
||||
float dither_shift = 0.25 * (1.0 / (pow(2, dither_bit) - 1.0));
|
||||
// Shift the individual colors differently, thus making it even harder to see the dithering pattern
|
||||
float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift); // Subpixel dithering
|
||||
// Modify shift acording to grid position.
|
||||
dither_shift_RGB = lerp(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position);
|
||||
depth += dither_shift_RGB;
|
||||
#endif
|
||||
|
||||
color = depth;
|
||||
if (iUIPresentType == 1)
|
||||
color = normal;
|
||||
if (iUIPresentType == 2)
|
||||
color = lerp(normal, depth, step(BUFFER_WIDTH * 0.5, position.x));
|
||||
|
||||
if (bUIShowOffset)
|
||||
{
|
||||
float3 color_orig = tex2D(ReShade::BackBuffer, texcoord).rgb;
|
||||
|
||||
// Blend depth and back buffer color with 'overlay' so the offset is more noticeable
|
||||
color = lerp(2 * color * color_orig, 1.0 - 2.0 * (1.0 - color) * (1.0 - color_orig), max(color.r, max(color.g, color.b)) < 0.5 ? 0.0 : 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
technique DisplayDepth <
|
||||
ui_tooltip =
|
||||
"This shader helps you set the right preprocessor settings for depth input.\n"
|
||||
"To set the settings click on 'Edit global preprocessor definitions' and set them there - not in this shader.\n"
|
||||
"The settings will then take effect for all shaders, including this one.\n"
|
||||
"\n"
|
||||
"By default calculated normals and depth are shown side by side.\n"
|
||||
"Normals (on the left) should look smooth and the ground should be greenish when looking at the horizon.\n"
|
||||
"Depth (on the right) should show close objects as dark and use gradually brighter shades the further away objects are.\n";
|
||||
ui_tooltip_ja_jp =
|
||||
"これは、深度バッファの入力をReShade側の計算式に合わせる調節をするための、設定作業の支援に特化した特殊な扱いのエフェクトです。\n"
|
||||
"初期状態では「両方を表示」が選択されており、左に法線マップ、右に深度マップが表示されます。\n"
|
||||
"\n"
|
||||
"法線マップ(左側)は、形状を滑らかに表現します。正しい設定では、全体的に青緑風で、地平線を見たときに地面が緑を帯びた色になります。\n"
|
||||
"深度マップ(右側)は、形状の遠近を白黒で表現します。正しい設定では、近くの形状ほど黒く、遠くの形状ほど白くなります。\n"
|
||||
"\n"
|
||||
#if ADDON_ADJUST_DEPTH
|
||||
"設定を完了するには、DisplayDepth.fxエフェクトの変数の一覧にある'設定に保存して反映する'ボタンをクリックして下さい。\n"
|
||||
#else
|
||||
"設定を完了するには、エフェクト変数の編集画面にある'プリプロセッサの定義を編集'ボタンをクリックした後に開くダイアログに入力して下さい。\n"
|
||||
#endif
|
||||
"すると、インストール先のゲームに対して共通の設定として保存され、他のプリセットでも正しく表示されるようになります。";
|
||||
>
|
||||
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = PostProcessVS;
|
||||
PixelShader = PS_DisplayDepth;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,7 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(__RESHADE__) || __RESHADE__ < 30000
|
||||
@ -105,6 +109,7 @@ namespace ReShade
|
||||
}
|
||||
|
||||
// Vertex shader generating a triangle covering the entire screen
|
||||
// See also https://www.reddit.com/r/gamedev/comments/2j17wk/a_slightly_faster_bufferless_vertex_shader_trick/
|
||||
void PostProcessVS(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD)
|
||||
{
|
||||
texcoord.x = (id == 2) ? 2.0 : 0.0;
|
||||
|
||||
@ -7,27 +7,27 @@
|
||||
#define RESHADE_VERSION(major,minor,build) (10000 * (major) + 100 * (minor) + (build))
|
||||
#define SUPPORTED_VERSION(major,minor,build) (__RESHADE__ >= RESHADE_VERSION(major,minor,build))
|
||||
|
||||
// Since 3.0.0
|
||||
// >= 3.0.0
|
||||
// Commit current in-game user interface status
|
||||
// https://github.com/crosire/reshade/commit/302bacc49ae394faedc2e29a296c1cebf6da6bb2#diff-82cf230afdb2a0d5174111e6f17548a5R1183
|
||||
// Added various GUI related uniform variable annotations
|
||||
// https://reshade.me/forum/releases/2341-3-0
|
||||
#define __UNIFORM_INPUT_ANY ui_type = "input";
|
||||
|
||||
#define __UNIFORM_INPUT_BOOL1 __UNIFORM_INPUT_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_INPUT_BOOL2 __UNIFORM_INPUT_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_INPUT_BOOL3 __UNIFORM_INPUT_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_INPUT_BOOL4 __UNIFORM_INPUT_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_INPUT_INT1 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_INT2 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_INT3 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_INT4 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_FLOAT1 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_FLOAT2 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_FLOAT3 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_FLOAT4 __UNIFORM_INPUT_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_INPUT_BOOL1 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_BOOL2 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_BOOL3 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_BOOL4 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_INT1 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_INT2 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_INT3 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_INT4 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_FLOAT1 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_FLOAT2 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_FLOAT3 __UNIFORM_INPUT_ANY
|
||||
#define __UNIFORM_INPUT_FLOAT4 __UNIFORM_INPUT_ANY
|
||||
|
||||
// Since 4.0.1
|
||||
// >= 4.0.1
|
||||
// Change slider widget to be used with new "slider" instead of a "drag" type annotation
|
||||
// https://github.com/crosire/reshade/commit/746229f31cd6f311a3e72a543e4f1f23faa23f11#diff-59405a313bd8cbfb0ca6dd633230e504R1701
|
||||
// Changed slider widget to be used with < ui_type = "slider"; > instead of < ui_type = "drag"; >
|
||||
@ -35,7 +35,7 @@
|
||||
#if SUPPORTED_VERSION(4,0,1)
|
||||
#define __UNIFORM_DRAG_ANY ui_type = "drag";
|
||||
|
||||
// Since 4.0.0
|
||||
// >= 4.0.0
|
||||
// Rework statistics tab and add drag widgets back
|
||||
// https://github.com/crosire/reshade/commit/1b2c38795f00efd66c007da1f483f1441b230309
|
||||
// Changed drag widget to a slider widget (old one is still available via < ui_type = "drag2"; >)
|
||||
@ -43,7 +43,7 @@
|
||||
#elif SUPPORTED_VERSION(4,0,0)
|
||||
#define __UNIFORM_DRAG_ANY ui_type = "drag2";
|
||||
|
||||
// Since 3.0.0
|
||||
// >= 3.0.0
|
||||
// Commit current in-game user interface status
|
||||
// https://github.com/crosire/reshade/commit/302bacc49ae394faedc2e29a296c1cebf6da6bb2#diff-82cf230afdb2a0d5174111e6f17548a5R1187
|
||||
// Added various GUI related uniform variable annotations
|
||||
@ -52,20 +52,20 @@
|
||||
#define __UNIFORM_DRAG_ANY ui_type = "drag";
|
||||
#endif
|
||||
|
||||
#define __UNIFORM_DRAG_BOOL1 __UNIFORM_DRAG_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_DRAG_BOOL2 __UNIFORM_DRAG_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_DRAG_BOOL3 __UNIFORM_DRAG_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_DRAG_BOOL4 __UNIFORM_DRAG_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_DRAG_INT1 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_INT2 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_INT3 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_INT4 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_FLOAT1 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_FLOAT2 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_FLOAT3 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_FLOAT4 __UNIFORM_DRAG_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_DRAG_BOOL1 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_BOOL2 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_BOOL3 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_BOOL4 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_INT1 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_INT2 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_INT3 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_INT4 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_FLOAT1 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_FLOAT2 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_FLOAT3 __UNIFORM_DRAG_ANY
|
||||
#define __UNIFORM_DRAG_FLOAT4 __UNIFORM_DRAG_ANY
|
||||
|
||||
// Since 4.0.1
|
||||
// >= 4.0.1
|
||||
// Change slider widget to be used with new "slider" instead of a "drag" type annotation
|
||||
// https://github.com/crosire/reshade/commit/746229f31cd6f311a3e72a543e4f1f23faa23f11#diff-59405a313bd8cbfb0ca6dd633230e504R1699
|
||||
// Changed slider widget to be used with < ui_type = "slider"; > instead of < ui_type = "drag"; >
|
||||
@ -73,7 +73,7 @@
|
||||
#if SUPPORTED_VERSION(4,0,1)
|
||||
#define __UNIFORM_SLIDER_ANY ui_type = "slider";
|
||||
|
||||
// Since 4.0.0
|
||||
// >= 4.0.0
|
||||
// Rework statistics tab and add drag widgets back
|
||||
// https://github.com/crosire/reshade/commit/1b2c38795f00efd66c007da1f483f1441b230309
|
||||
// Changed drag widget to a slider widget (old one is still available via < ui_type = "drag2"; >)
|
||||
@ -84,20 +84,20 @@
|
||||
#define __UNIFORM_SLIDER_ANY __UNIFORM_DRAG_ANY
|
||||
#endif
|
||||
|
||||
#define __UNIFORM_SLIDER_BOOL1 __UNIFORM_SLIDER_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_SLIDER_BOOL2 __UNIFORM_SLIDER_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_SLIDER_BOOL3 __UNIFORM_SLIDER_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_SLIDER_BOOL4 __UNIFORM_SLIDER_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_SLIDER_INT1 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_INT2 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_INT3 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_INT4 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_FLOAT1 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_FLOAT2 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_FLOAT3 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_FLOAT4 __UNIFORM_SLIDER_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_SLIDER_BOOL1 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_BOOL2 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_BOOL3 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_BOOL4 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_INT1 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_INT2 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_INT3 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_INT4 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_FLOAT1 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_FLOAT2 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_FLOAT3 __UNIFORM_SLIDER_ANY
|
||||
#define __UNIFORM_SLIDER_FLOAT4 __UNIFORM_SLIDER_ANY
|
||||
|
||||
// Since 3.0.0
|
||||
// >= 3.0.0
|
||||
// Add combo box display type for uniform variables and fix displaying of integer variable under Direct3D 9
|
||||
// https://github.com/crosire/reshade/commit/b025bfae5f7343509ec0cacf6df0cff537c499f2#diff-82cf230afdb2a0d5174111e6f17548a5R1631
|
||||
// Added various GUI related uniform variable annotations
|
||||
@ -105,19 +105,19 @@
|
||||
#define __UNIFORM_COMBO_ANY ui_type = "combo";
|
||||
|
||||
// __UNIFORM_COMBO_BOOL1
|
||||
#define __UNIFORM_COMBO_BOOL2 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_BOOL3 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_BOOL4 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_INT1 __UNIFORM_COMBO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COMBO_INT2 __UNIFORM_COMBO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COMBO_INT3 __UNIFORM_COMBO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COMBO_INT4 __UNIFORM_COMBO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COMBO_FLOAT1 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_FLOAT2 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_FLOAT3 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_FLOAT4 __UNIFORM_COMBO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COMBO_BOOL2 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_BOOL3 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_BOOL4 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_INT1 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_INT2 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_INT3 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_INT4 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_FLOAT1 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_FLOAT2 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_FLOAT3 __UNIFORM_COMBO_ANY
|
||||
#define __UNIFORM_COMBO_FLOAT4 __UNIFORM_COMBO_ANY
|
||||
|
||||
// Since 4.0.0 (but the ui_items force set "Off\0On\0"), and if less than it force converted to checkbox
|
||||
// >= 4.0.0
|
||||
// Add option to display boolean values as combo box instead of checkbox
|
||||
// https://github.com/crosire/reshade/commit/aecb757c864c9679e77edd6f85a1521c49e489c1#diff-59405a313bd8cbfb0ca6dd633230e504R1147
|
||||
// https://github.com/crosire/reshade/blob/v4.0.0/source/gui.cpp
|
||||
@ -125,7 +125,7 @@
|
||||
// https://reshade.me/forum/releases/4772-4-0
|
||||
#define __UNIFORM_COMBO_BOOL1 __UNIFORM_COMBO_ANY
|
||||
|
||||
// Since 4.0.0
|
||||
// >= 4.0.0
|
||||
// Cleanup GUI code and rearrange some widgets
|
||||
// https://github.com/crosire/reshade/commit/6751f7bd50ea7c0556cf0670f10a4b4ba912ee7d#diff-59405a313bd8cbfb0ca6dd633230e504R1711
|
||||
// Added radio button widget (via < ui_type = "radio"; ui_items = "Button 1\0Button 2\0...\0"; >)
|
||||
@ -136,48 +136,46 @@
|
||||
#define __UNIFORM_RADIO_ANY __UNIFORM_COMBO_ANY
|
||||
#endif
|
||||
|
||||
#define __UNIFORM_RADIO_BOOL1 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_BOOL2 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_BOOL3 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_BOOL4 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_INT1 __UNIFORM_RADIO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_RADIO_INT2 __UNIFORM_RADIO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_RADIO_INT3 __UNIFORM_RADIO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_RADIO_INT4 __UNIFORM_RADIO_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_RADIO_FLOAT1 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_FLOAT2 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_FLOAT3 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_FLOAT4 __UNIFORM_RADIO_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_RADIO_BOOL1 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_BOOL2 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_BOOL3 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_BOOL4 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_INT1 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_INT2 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_INT3 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_INT4 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_FLOAT1 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_FLOAT2 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_FLOAT3 __UNIFORM_RADIO_ANY
|
||||
#define __UNIFORM_RADIO_FLOAT4 __UNIFORM_RADIO_ANY
|
||||
|
||||
// Since 4.1.0
|
||||
// >= 4.1.0
|
||||
// Fix floating point uniforms with unknown "ui_type" not showing up in UI
|
||||
// https://github.com/crosire/reshade/commit/50e5bf44dfc84bc4220c2b9f19d5f50c7a0fda66#diff-59405a313bd8cbfb0ca6dd633230e504R1788
|
||||
// Fixed floating point uniforms with unknown "ui_type" not showing up in UI
|
||||
// https://reshade.me/forum/releases/5021-4-1
|
||||
#define __UNIFORM_COLOR_ANY ui_type = "color";
|
||||
|
||||
// Since 3.0.0
|
||||
// >= 3.0.0
|
||||
// Move technique list to preset configuration file
|
||||
// https://github.com/crosire/reshade/blob/84bba3aa934c1ebe4c6419b69dfe1690d9ab9d34/source/runtime.cpp#L1328
|
||||
// Added various GUI related uniform variable annotations
|
||||
// https://reshade.me/forum/releases/2341-3-0
|
||||
|
||||
// If empty, these versions before 4.1.0 are decide that the type is color from the number of components
|
||||
|
||||
#define __UNIFORM_COLOR_BOOL1 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_BOOL2 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_BOOL3 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_BOOL4 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_INT1 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_INT2 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_INT3 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_INT4 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_BOOL1 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_BOOL2 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_BOOL3 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_BOOL4 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_INT1 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_INT2 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_INT3 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_INT4 __UNIFORM_COLOR_ANY
|
||||
// __UNIFORM_COLOR_FLOAT1
|
||||
#define __UNIFORM_COLOR_FLOAT2 __UNIFORM_COLOR_ANY // It is unsupported on all version
|
||||
#define __UNIFORM_COLOR_FLOAT3 __UNIFORM_COLOR_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COLOR_FLOAT4 __UNIFORM_COLOR_ANY // If it was not supported in someday or now, please add information
|
||||
#define __UNIFORM_COLOR_FLOAT2 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_FLOAT3 __UNIFORM_COLOR_ANY
|
||||
#define __UNIFORM_COLOR_FLOAT4 __UNIFORM_COLOR_ANY
|
||||
|
||||
// Since 4.2.0
|
||||
// >= 4.2.0
|
||||
// Add alpha slider widget for single component uniform variables (#86)
|
||||
// https://github.com/crosire/reshade/commit/87a740a8e3c4dcda1dd4eeec8d5cff7fa35fe829#diff-59405a313bd8cbfb0ca6dd633230e504R1820
|
||||
// Added alpha slider widget for single component uniform variables
|
||||
@ -188,7 +186,7 @@
|
||||
#define __UNIFORM_COLOR_FLOAT1 __UNIFORM_SLIDER_ANY
|
||||
#endif
|
||||
|
||||
// Since 4.3.0
|
||||
// >= 4.3.0
|
||||
// Add new "list" GUI widget (#103)
|
||||
// https://github.com/crosire/reshade/commit/515287d20ce615c19cf3d4c21b49f83896f04ddc#diff-59405a313bd8cbfb0ca6dd633230e504R1894
|
||||
// Added new "list" GUI widget
|
||||
@ -200,17 +198,17 @@
|
||||
#endif
|
||||
|
||||
// __UNIFORM_LIST_BOOL1
|
||||
#define __UNIFORM_LIST_BOOL2 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_BOOL3 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_BOOL4 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_INT1 __UNIFORM_LIST_ANY // Supported in 4.3.0
|
||||
#define __UNIFORM_LIST_INT2 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_INT3 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_INT4 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_FLOAT1 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_FLOAT2 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_FLOAT3 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_FLOAT4 __UNIFORM_LIST_ANY // Not supported in all versions
|
||||
#define __UNIFORM_LIST_BOOL2 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_BOOL3 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_BOOL4 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_INT1 __UNIFORM_LIST_ANY // >= 4.3.0
|
||||
#define __UNIFORM_LIST_INT2 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_INT3 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_INT4 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_FLOAT1 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_FLOAT2 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_FLOAT3 __UNIFORM_LIST_ANY
|
||||
#define __UNIFORM_LIST_FLOAT4 __UNIFORM_LIST_ANY
|
||||
|
||||
// For compatible with ComboBox
|
||||
// For compatible with 'combo'
|
||||
#define __UNIFORM_LIST_BOOL1 __UNIFORM_COMBO_ANY
|
||||
|
||||
289
data/resources/shaders/reshade/Shaders/UIMask.fx
Normal file
289
data/resources/shaders/reshade/Shaders/UIMask.fx
Normal file
@ -0,0 +1,289 @@
|
||||
/*
|
||||
Simple UIMask shader by luluco250
|
||||
|
||||
I have no idea why this was never ported back to ReShade 3.0 from 2.0,
|
||||
but if you missed it, here it is.
|
||||
|
||||
It doesn't feature the auto mask from the original shader.
|
||||
|
||||
It does feature a new multi-channnel masking feature. UI masks can now contain
|
||||
separate 'modes' within each of the three color channels.
|
||||
|
||||
For example, you can have the regular hud on the red channel (the default one),
|
||||
a mask for an inventory screen on the green channel and a mask for a quest menu
|
||||
on the blue channel. You can then use keyboard keys to toggle each channel on or off.
|
||||
|
||||
Multiple channels can be active at once, they'll just add up to mask the image.
|
||||
|
||||
Simple/legacy masks are not affected by this, they'll work just as you'd expect,
|
||||
so you can still make simple black and white masks that use all color channels, it'll
|
||||
be no different than just having it on a single channel.
|
||||
|
||||
Tips:
|
||||
|
||||
--You can adjust how much it will affect your HUD by changing "Mask Intensity".
|
||||
|
||||
--You don't actually need to place the UIMask_Bottom technique at the bottom of
|
||||
your shader pipeline, if you have any effects that don't necessarily affect
|
||||
the visibility of the HUD you can place it before that.
|
||||
For instance, if you use color correction shaders like LUT, you might want
|
||||
to place UIMask_Bottom just before that.
|
||||
|
||||
--Preprocessor flags:
|
||||
--UIMASK_MULTICHANNEL:
|
||||
Enables having up to three different masks on each color channel.
|
||||
|
||||
--Refer to this page for keycodes:
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
|
||||
|
||||
--To make a custom mask:
|
||||
|
||||
1-Take a screenshot of your game with the HUD enabled,
|
||||
preferrably with any effects disabled for maximum visibility.
|
||||
|
||||
2-Open the screenshot with your preferred image editor program, I use GIMP.
|
||||
|
||||
3-Make a background white layer if there isn't one already.
|
||||
Be sure to leave it behind your actual screenshot for the while.
|
||||
|
||||
4-Make an empty layer for the mask itself, you can call it "mask".
|
||||
|
||||
5-Having selected the mask layer, paint the places where HUD constantly is,
|
||||
such as health bars, important messages, minimaps etc.
|
||||
|
||||
6-Delete or make your screenshot layer invisible.
|
||||
|
||||
7-Before saving your mask, let's do some gaussian blurring to improve it's look and feel:
|
||||
For every step of blurring you want to do, make a new layer, such as:
|
||||
Mask - Blur16x16
|
||||
Mask - Blur8x8
|
||||
Mask - Blur4x4
|
||||
Mask - Blur2x2
|
||||
Mask - NoBlur
|
||||
You should use your image editor's default gaussian blurring filter, if there is one.
|
||||
This avoids possible artifacts and makes the mask blend more easily on the eyes.
|
||||
You may not need this if your mask is accurate enough and/or the HUD is simple enough.
|
||||
|
||||
8-Now save the final image with a unique name such as "MyUIMask.png" in your textures folder.
|
||||
|
||||
9-Set the preprocessor definition UIMASK_TEXTURE to the unique name of your image, with quotes.
|
||||
You're done!
|
||||
|
||||
|
||||
MIT Licensed:
|
||||
|
||||
Copyright (c) 2017 Lucas Melo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
//#region Preprocessor
|
||||
|
||||
#include "ReShade.fxh"
|
||||
#include "ReShadeUI.fxh"
|
||||
|
||||
#ifndef UIMASK_MULTICHANNEL
|
||||
#define UIMASK_MULTICHANNEL 0
|
||||
#endif
|
||||
|
||||
#if !UIMASK_MULTICHANNEL
|
||||
#define TEXFORMAT R8
|
||||
#else
|
||||
#define TEXFORMAT RGBA8
|
||||
#endif
|
||||
|
||||
#ifndef UIMASK_TEXTURE
|
||||
#define UIMASK_TEXTURE "UIMask.png"
|
||||
#endif
|
||||
|
||||
//#endregion
|
||||
|
||||
namespace UIMask
|
||||
{
|
||||
|
||||
//#region Uniforms
|
||||
|
||||
uniform int _Help
|
||||
<
|
||||
ui_label = " ";
|
||||
ui_text =
|
||||
"For more detailed instructions, see the text at the top of this "
|
||||
"effect's shader file (UIMask.fx).\n"
|
||||
"\n"
|
||||
"Available preprocessor definitions:\n"
|
||||
" UIMASK_MULTICHANNEL:\n"
|
||||
" If set to 1, each of the RGB color channels in the texture is "
|
||||
"treated as a separate mask.\n"
|
||||
"\n"
|
||||
"How to create a mask:\n"
|
||||
"\n"
|
||||
"1. Take a screenshot with the game's UI appearing.\n"
|
||||
"2. Open the screenshot in an image editor, GIMP or Photoshop are "
|
||||
"recommended.\n"
|
||||
"3. Create a new layer over the screenshot layer, fill it with black.\n"
|
||||
"4. Reduce the layer opacity so you can see the screenshot layer "
|
||||
"below.\n"
|
||||
"5. Cover the UI with white to mask it from effects. The stronger the "
|
||||
"mask white color, the more opaque the mask will be.\n"
|
||||
"6. Set the mask layer opacity back to 100%.\n"
|
||||
"7. Save the image in one of your texture folders, making sure to "
|
||||
"use a unique name such as: \"MyUIMask.png\"\n"
|
||||
"8. Set the preprocessor definition UIMASK_TEXTURE to the name of "
|
||||
"your image, with quotes: \"MyUIMask.png\"\n"
|
||||
;
|
||||
ui_category = "Help";
|
||||
ui_category_closed = true;
|
||||
ui_type = "radio";
|
||||
>;
|
||||
|
||||
uniform float fMask_Intensity
|
||||
<
|
||||
__UNIFORM_SLIDER_FLOAT1
|
||||
|
||||
ui_label = "Mask Intensity";
|
||||
ui_tooltip =
|
||||
"How much to mask effects from affecting the original image.\n"
|
||||
"\nDefault: 1.0";
|
||||
ui_min = 0.0;
|
||||
ui_max = 1.0;
|
||||
ui_step = 0.001;
|
||||
> = 1.0;
|
||||
|
||||
uniform bool bDisplayMask <
|
||||
ui_label = "Display Mask";
|
||||
ui_tooltip =
|
||||
"Display the mask texture.\n"
|
||||
"Useful for testing multiple channels or simply the mask itself.\n"
|
||||
"\nDefault: Off";
|
||||
> = false;
|
||||
|
||||
#if UIMASK_MULTICHANNEL
|
||||
|
||||
uniform bool bToggleRed <
|
||||
ui_label = "Toggle Red Channel";
|
||||
ui_tooltip = "Toggle UI masking for the red channel.\n"
|
||||
"Right click to assign a hotkey.\n"
|
||||
"\nDefault: On";
|
||||
> = true;
|
||||
|
||||
uniform bool bToggleGreen <
|
||||
ui_label = "Toggle Green Channel";
|
||||
ui_tooltip = "Toggle UI masking for the green channel.\n"
|
||||
"Right click to assign a hotkey."
|
||||
"\nDefault: On";
|
||||
> = true;
|
||||
|
||||
uniform bool bToggleBlue <
|
||||
ui_label = "Toggle Blue Channel";
|
||||
ui_tooltip = "Toggle UI masking for the blue channel.\n"
|
||||
"Right click to assign a hotkey."
|
||||
"\nDefault: On";
|
||||
> = true;
|
||||
|
||||
#endif
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Textures
|
||||
|
||||
texture BackupTex
|
||||
{
|
||||
Width = BUFFER_WIDTH;
|
||||
Height = BUFFER_HEIGHT;
|
||||
};
|
||||
sampler Backup
|
||||
{
|
||||
Texture = BackupTex;
|
||||
};
|
||||
|
||||
texture MaskTex <source=UIMASK_TEXTURE;>
|
||||
{
|
||||
Width = BUFFER_WIDTH;
|
||||
Height = BUFFER_HEIGHT;
|
||||
Format = TEXFORMAT;
|
||||
};
|
||||
sampler Mask
|
||||
{
|
||||
Texture = MaskTex;
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Shaders
|
||||
|
||||
float4 BackupPS(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||
return tex2D(ReShade::BackBuffer, uv);
|
||||
}
|
||||
|
||||
float4 MainPS(float4 pos : SV_Position, float2 uv : TEXCOORD) : SV_Target {
|
||||
float4 color = tex2D(ReShade::BackBuffer, uv);
|
||||
float4 backup = tex2D(Backup, uv);
|
||||
|
||||
#if !UIMASK_MULTICHANNEL
|
||||
float mask = tex2D(Mask, uv).r;
|
||||
#else
|
||||
float3 mask_rgb = tex2D(Mask, uv).rgb;
|
||||
|
||||
// This just works, it basically adds masking with each channel that has
|
||||
// been toggled.
|
||||
float mask = saturate(
|
||||
1.0 - dot(1.0 - mask_rgb,
|
||||
float3(bToggleRed, bToggleGreen, bToggleBlue)));
|
||||
#endif
|
||||
|
||||
color = lerp(color, backup, mask * fMask_Intensity);
|
||||
color = bDisplayMask ? mask : color;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Techniques
|
||||
|
||||
technique UIMask_Top
|
||||
<
|
||||
ui_tooltip = "Place this *above* the effects to be masked.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = PostProcessVS;
|
||||
PixelShader = BackupPS;
|
||||
RenderTarget = BackupTex;
|
||||
}
|
||||
}
|
||||
|
||||
technique UIMask_Bottom
|
||||
<
|
||||
ui_tooltip =
|
||||
"Place this *below* the effects to be masked.\n"
|
||||
"If you want to add a toggle key for the effect, set it to this one.";
|
||||
>
|
||||
{
|
||||
pass
|
||||
{
|
||||
VertexShader = PostProcessVS;
|
||||
PixelShader = MainPS;
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
} // Namespace.
|
||||
Reference in New Issue
Block a user