-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17c5105
commit 17f8c9e
Showing
53 changed files
with
6,882 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
/* | ||
* Copyright (C) 2024 Musa Haji | ||
* Copyright (C) 2024 Carlos Lopez | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#define ImTextureID ImU64 | ||
|
||
#define DEBUG_LEVEL_0 | ||
#define DEBUG_SLIDERS_OFF | ||
|
||
#include <deps/imgui/imgui.h> | ||
|
||
#include <embed/0x24182048.h> // Color Grading - main menu & prologue | ||
#include <embed/0x73E7A34D.h> // Color Grading - main menu & prologue - sharpening low | ||
#include <embed/0xD7BC63A1.h> // Color Grading - level 1: Inkwater Marsh | ||
|
||
// additional color grading shaders done in batch | ||
#include <embed/0x063548F6.h> | ||
#include <embed/0x0BE6093C.h> | ||
#include <embed/0x0E0EE842.h> | ||
#include <embed/0x1A46FADC.h> | ||
#include <embed/0x1E8FDB7D.h> | ||
#include <embed/0x211F3245.h> | ||
#include <embed/0x28B10677.h> | ||
#include <embed/0x2CEC407A.h> | ||
#include <embed/0x34F7E01C.h> | ||
#include <embed/0x350163E1.h> | ||
#include <embed/0x37E6CB72.h> | ||
#include <embed/0x3F118009.h> | ||
#include <embed/0x3FDCF7AA.h> | ||
#include <embed/0x48CDE62E.h> | ||
#include <embed/0x4A3D4181.h> | ||
#include <embed/0x596B9BD3.h> | ||
#include <embed/0x5B0965E4.h> | ||
#include <embed/0x5CDE4A30.h> | ||
#include <embed/0x613B5403.h> | ||
#include <embed/0x62C79AA3.h> | ||
#include <embed/0x649A0B90.h> | ||
#include <embed/0x7C14BB2C.h> | ||
#include <embed/0x841FAF0A.h> | ||
#include <embed/0x84C7D93E.h> | ||
#include <embed/0x8A303253.h> | ||
#include <embed/0x8B1DE268.h> | ||
#include <embed/0x8D6097D1.h> | ||
#include <embed/0x8D6C34A5.h> | ||
#include <embed/0x8EC5798A.h> | ||
#include <embed/0x9AC0DEEF.h> | ||
#include <embed/0x9B5CC768.h> | ||
#include <embed/0x9DA86DCE.h> | ||
#include <embed/0xA6488EB2.h> | ||
#include <embed/0xABD8D6B7.h> | ||
#include <embed/0xB24C1A54.h> | ||
#include <embed/0xB270CA5B.h> | ||
#include <embed/0xC4128983.h> | ||
#include <embed/0xD9B57ECB.h> | ||
#include <embed/0xDB90C883.h> | ||
#include <embed/0xDE975B11.h> | ||
#include <embed/0xE3F6E54F.h> | ||
#include <embed/0xF017475F.h> | ||
#include <embed/0xF3917C63.h> | ||
#include <embed/0xF7933F3F.h> | ||
#include <embed/0xFCF0717A.h> | ||
|
||
#include <embed/0x9D323EA3.h> // Inverse tonemap, garbage default hdr implementation | ||
#include <embed/0xF9C2BDE1.h> // DICE, final bt2020 conversion, paper white, and pq encode | ||
|
||
#include <include/reshade.hpp> | ||
#include "../../mods/shader.hpp" | ||
#include "../../utils/settings.hpp" | ||
#include "./shared.h" | ||
|
||
namespace { | ||
|
||
renodx::mods::shader::CustomShaders custom_shaders = { | ||
CustomShaderEntry(0x24182048), // Color Grading - main menu & prologue | ||
CustomShaderEntry(0x73E7A34D), // Color Grading - main menu & prologue - sharpening low | ||
CustomShaderEntry(0xD7BC63A1), // Color Grading - level 1 | ||
|
||
// additional color grading shaders done in batch | ||
CustomShaderEntry(0x063548F6), | ||
CustomShaderEntry(0x0BE6093C), | ||
CustomShaderEntry(0x0E0EE842), | ||
CustomShaderEntry(0x1A46FADC), | ||
CustomShaderEntry(0x1E8FDB7D), | ||
CustomShaderEntry(0x211F3245), | ||
CustomShaderEntry(0x28B10677), | ||
CustomShaderEntry(0x2CEC407A), | ||
CustomShaderEntry(0x34F7E01C), | ||
CustomShaderEntry(0x350163E1), | ||
CustomShaderEntry(0x37E6CB72), | ||
CustomShaderEntry(0x3F118009), | ||
CustomShaderEntry(0x3FDCF7AA), | ||
CustomShaderEntry(0x48CDE62E), | ||
CustomShaderEntry(0x4A3D4181), | ||
CustomShaderEntry(0x596B9BD3), | ||
CustomShaderEntry(0x5B0965E4), | ||
CustomShaderEntry(0x5CDE4A30), | ||
CustomShaderEntry(0x613B5403), | ||
CustomShaderEntry(0x62C79AA3), | ||
CustomShaderEntry(0x649A0B90), | ||
CustomShaderEntry(0x7C14BB2C), | ||
CustomShaderEntry(0x841FAF0A), | ||
CustomShaderEntry(0x84C7D93E), | ||
CustomShaderEntry(0x8A303253), | ||
CustomShaderEntry(0x8B1DE268), | ||
CustomShaderEntry(0x8D6097D1), | ||
CustomShaderEntry(0x8D6C34A5), | ||
CustomShaderEntry(0x8EC5798A), | ||
CustomShaderEntry(0x9AC0DEEF), | ||
CustomShaderEntry(0x9B5CC768), | ||
CustomShaderEntry(0x9DA86DCE), | ||
CustomShaderEntry(0xA6488EB2), | ||
CustomShaderEntry(0xABD8D6B7), | ||
CustomShaderEntry(0xB24C1A54), | ||
CustomShaderEntry(0xB270CA5B), | ||
CustomShaderEntry(0xC4128983), | ||
CustomShaderEntry(0xD9B57ECB), | ||
CustomShaderEntry(0xDB90C883), | ||
CustomShaderEntry(0xDE975B11), | ||
CustomShaderEntry(0xE3F6E54F), | ||
CustomShaderEntry(0xF017475F), | ||
CustomShaderEntry(0xF3917C63), | ||
CustomShaderEntry(0xF7933F3F), | ||
CustomShaderEntry(0xFCF0717A), | ||
|
||
CustomShaderEntry(0x9D323EA3), // Inverse tonemap, garbage default hdr implementation | ||
CustomShaderEntry(0xF9C2BDE1), // DICE, final bt2020 conversion, paper white, and pq encode | ||
}; | ||
|
||
ShaderInjectData shader_injection; | ||
|
||
renodx::utils::settings::Settings settings = { | ||
new renodx::utils::settings::Setting{ | ||
.key = "toneMapType", | ||
.binding = &shader_injection.toneMapType, | ||
.value_type = renodx::utils::settings::SettingValueType::INTEGER, | ||
.default_value = 2.f, | ||
.can_reset = false, | ||
.label = "Tone Mapper", | ||
.section = "Tone Mapping", | ||
.tooltip = "Sets the tone mapper type", | ||
.labels = {"Vanilla (Fake HDR)", "None", "DICE"}, | ||
}, | ||
new renodx::utils::settings::Setting{ | ||
.key = "toneMapPeakNits", | ||
.binding = &shader_injection.toneMapPeakNits, | ||
.default_value = 1000.f, | ||
.can_reset = false, | ||
.label = "Peak Brightness", | ||
.section = "Tone Mapping", | ||
.tooltip = "Sets the value of peak white in nits", | ||
.min = 48.f, | ||
.max = 4000.f, | ||
}, | ||
new renodx::utils::settings::Setting{ | ||
.key = "toneMapGameNits", | ||
.binding = &shader_injection.toneMapGameNits, | ||
.default_value = 203.f, | ||
.can_reset = false, | ||
.label = "Game Brightness", | ||
.section = "Tone Mapping", | ||
.tooltip = "Sets the value of 100%% white in nits", | ||
.min = 48.f, | ||
.max = 500.f, | ||
}, | ||
new renodx::utils::settings::Setting{ | ||
.key = "toneMapHueCorrection", | ||
.binding = &shader_injection.toneMapHueCorrection, | ||
.default_value = 50.f, | ||
.can_reset = false, | ||
.label = "Hue Correction", | ||
.section = "Tone Mapping", | ||
.tooltip = "Emulates hue shifting from the vanilla tonemapper", | ||
.max = 100.f, | ||
.is_enabled = []() { return shader_injection.toneMapType != 0; }, | ||
.parse = [](float value) { return value * 0.01f; }, | ||
}, | ||
new renodx::utils::settings::Setting{ | ||
.key = "colorGradeStrength", | ||
.binding = &shader_injection.colorGradeStrength, | ||
.default_value = 100.f, | ||
.label = "Color Grade Strength", | ||
.section = "Color Grading", | ||
.max = 100.f, | ||
.parse = [](float value) { return value * 0.01f; }, | ||
}, | ||
}; | ||
|
||
void OnPresetOff() { | ||
renodx::utils::settings::UpdateSetting("toneMapType", 0); | ||
renodx::utils::settings::UpdateSetting("toneMapPeakNits", 1000.f); | ||
renodx::utils::settings::UpdateSetting("toneMapGameNits", 203.f); | ||
renodx::utils::settings::UpdateSetting("toneMapGammaCorrection", 1.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeExposure", 1.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeHighlights", 50.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeShadows", 50.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeContrast", 50.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeSaturation", 50.f); | ||
renodx::utils::settings::UpdateSetting("colorGradeStrength", 100.f); | ||
} | ||
|
||
} // namespace | ||
|
||
// NOLINTBEGIN(readability-identifier-naming) | ||
|
||
extern "C" __declspec(dllexport) const char* NAME = "RenoDX"; | ||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "RenoDX for Ori and the Will of the Wisps"; | ||
|
||
// NOLINTEND(readability-identifier-naming) | ||
|
||
BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) { | ||
switch (fdw_reason) { | ||
case DLL_PROCESS_ATTACH: | ||
renodx::mods::shader::force_pipeline_cloning = true; | ||
renodx::mods::shader::expected_constant_buffer_index = 11; | ||
|
||
if (!reshade::register_addon(h_module)) return FALSE; | ||
|
||
break; | ||
case DLL_PROCESS_DETACH: | ||
reshade::unregister_addon(h_module); | ||
break; | ||
} | ||
|
||
renodx::utils::settings::Use(fdw_reason, &settings, &OnPresetOff); | ||
|
||
renodx::mods::shader::Use(fdw_reason, custom_shaders, &shader_injection); | ||
|
||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#include "./shared.h" | ||
|
||
// ---- Created with 3Dmigoto v1.3.16 on Thu Aug 15 21:12:45 2024 | ||
Texture2D<float4> t4 : register(t4); | ||
|
||
Texture2D<float4> t3 : register(t3); | ||
|
||
Texture2D<float4> t2 : register(t2); | ||
|
||
Texture2D<float4> t1 : register(t1); | ||
|
||
Texture2D<float4> t0 : register(t0); | ||
|
||
SamplerState s3_s : register(s3); | ||
|
||
SamplerState s2_s : register(s2); | ||
|
||
SamplerState s1_s : register(s1); | ||
|
||
SamplerState s0_s : register(s0); | ||
|
||
cbuffer cb0 : register(b0) | ||
{ | ||
float4 cb0[22]; | ||
} | ||
|
||
|
||
|
||
|
||
// 3Dmigoto declarations | ||
#define cmp - | ||
|
||
|
||
void main( | ||
float4 v0 : SV_POSITION0, | ||
linear noperspective float2 v1 : TEXCOORD0, | ||
linear noperspective float2 w1 : TEXCOORD1, | ||
linear noperspective float2 v2 : TEXCOORD2, | ||
out float4 o0 : SV_Target0) | ||
{ | ||
float4 r0,r1,r2,r3,r4,r5,r6,r7,r8; | ||
uint4 bitmask, uiDest; | ||
float4 fDest; | ||
|
||
r0.xy = t0.Sample(s2_s, v2.xy).xy; | ||
r0.xy = float2(-0.498039216,-0.498039216) + r0.xy; | ||
r0.xy = float2(0.100000001,0.100000001) * r0.xy; | ||
r0.zw = r0.xy * cb0[5].xy + v1.xy; | ||
r0.xy = r0.xy * cb0[5].xy + v2.xy; | ||
r0.xy = min(cb0[6].zw, r0.xy); | ||
r1.xyzw = t2.Sample(s1_s, r0.xy).xyzw; // blur? | ||
r1.xyzw = saturate(-r1.xyzw * cb0[21].xxxx + float4(1,1,1,1)); | ||
r2.xyzw = min(cb0[6].xyxy, r0.zwzw); | ||
r0.xy = r0.zw / cb0[5].xy; | ||
r3.xyzw = cb0[3].xyxy * float4(-1.5,-1.5,1.5,-1.5) + r2.zwzw; | ||
r4.xyz = t1.Sample(s0_s, r3.xy).xyz; | ||
r3.xyz = t1.Sample(s0_s, r3.zw).xyz; | ||
r3.xyz = r4.xyz + r3.xyz; | ||
r4.xyzw = cb0[3].xyxy * float4(-1.5,1.5,1.5,1.5) + r2.xyzw; | ||
r2.xyzw = t1.Sample(s0_s, r2.zw).xyzw; // render | ||
|
||
r5.xyz = t1.Sample(s0_s, r4.xy).xyz; | ||
r4.xyz = t1.Sample(s0_s, r4.zw).xyz; | ||
r3.xyz = r5.xyz + r3.xyz; | ||
r3.xyz = r3.xyz + r4.xyz; | ||
r3.xyz = -r3.xyz * float3(0.25,0.25,0.25) + r2.xyz; | ||
r3.xyz = r3.xyz * cb0[8].yyy + r2.xyz; | ||
r0.zw = min(cb0[13].zw, r0.xy); | ||
r4.xyz = t4.Sample(s3_s, r0.xy).xyz; // ori glow | ||
r0.xyz = t3.Sample(s3_s, r0.zw).xyz; // sun glow | ||
r5.xyz = cb0[13].xxx * r0.xyz; | ||
r0.xyz = cb0[13].yyy + r0.xyz; | ||
r0.xyz = r5.xyz / r0.xyz; | ||
r0.xyz = r3.xyz + r0.xyz; | ||
r0.w = max(r4.y, r4.z); | ||
r0.w = max(r4.x, r0.w); | ||
r3.x = cmp(cb0[12].z < r0.w); | ||
r0.w = cb0[12].z / r0.w; | ||
r0.w = r3.x ? r0.w : 1; | ||
r2.xyz = r4.xyz * r0.www + r0.xyz; | ||
r0.xy = w1.xy * float2(2,2) + float2(-1,-1); | ||
r0.x = dot(r0.xy, r0.xy); | ||
r0.x = min(1, r0.x); | ||
r0.x = cb0[8].x * r0.x; | ||
r0.x = r0.x * 7 + 1; | ||
r0.xyzw = r2.xyzw * r0.xxxx; | ||
|
||
r2.xyz = cb0[17].xyz * r0.xyz; // r2.xyz = saturate(cb0[17].xyz * r0.xyz); | ||
float3 hdrColor = r2.xyz; | ||
r2.xyz = saturate(r2.xyz); | ||
|
||
r3.xyz = r2.xyz * r2.xyz; | ||
r4.xyz = r3.xyz * r2.xyz; | ||
r5.w = r4.x; | ||
r6.xyz = float3(1,1,1) + -r2.xyz; | ||
r7.xyz = r6.xyz * r6.xyz; | ||
r8.xyz = r7.yxz * r6.yxz; | ||
r3.xyz = r6.xyz * r3.xyz; | ||
r2.xyz = r7.xzy * r2.xzy; | ||
r5.x = r8.y; | ||
r5.y = r2.x; | ||
r5.z = r3.x; | ||
r5.x = dot(r5.xyzw, cb0[14].xyzw); | ||
r2.x = r8.z; | ||
r8.y = r2.z; | ||
r8.z = r3.y; | ||
r2.z = r3.z; | ||
r8.w = r4.y; | ||
r2.w = r4.z; | ||
r5.z = dot(r2.xyzw, cb0[16].xyzw); | ||
r5.y = dot(r8.xyzw, cb0[15].xyzw); | ||
r0.xyz = r5.xyz * cb0[9].xxx + cb0[9].yyy; | ||
r2.x = saturate(dot(r0.xyz, float3(0.219999999,0.707000017,0.0710000023))); // BOURGIN D65 Y | ||
r2.xyzw = r2.xxxx + -r0.xyzw; | ||
r0.xyzw = cb0[10].xxxx * r2.xyzw + r0.xyzw; | ||
r0.xyzw = float4(1,1,1,1) + -r0.xyzw; | ||
r2.xyzw = -r1.xyzw * r0.xyzw + float4(1,1,1,1); | ||
r0.xyz = -r1.xyz * r0.xyz + float3(0.5,0.5,0.5); | ||
r1.xy = float2(-0.5,-0.5) + w1.xy; | ||
r0.w = dot(r1.xy, r1.xy); | ||
r0.w = sqrt(r0.w); | ||
r0.w = r0.w * 0.720000029 + -0.800000012; | ||
r0.w = saturate(-1.83715463 * r0.w); | ||
r1.x = r0.w * -2 + 3; | ||
r0.w = r0.w * r0.w; | ||
r1.y = r1.x * r0.w + -1; | ||
r0.w = r1.x * r0.w; | ||
r1.x = -r1.y * 0.200000003 + 1; | ||
r1.x = max(1, r1.x); | ||
r0.xyz = r0.xyz * r1.xxx + float3(0.5,0.5,0.5); | ||
r0.xyz = r0.xyz * r0.www + -r2.xyz; | ||
r0.w = 0; | ||
|
||
|
||
o0.xyzw = cb0[12].yyyy * r0.xyzw + r2.xyzw; // vignette + render | ||
if (injectedData.toneMapType != 0) { | ||
// preserve SDR color grading | ||
o0.xyz = renodx::tonemap::UpgradeToneMap(hdrColor, saturate(hdrColor), o0.xyz, injectedData.colorGradeStrength); | ||
} | ||
return; | ||
} |
Oops, something went wrong.