mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-21 00:59:59 -04:00
Triforce v0.5.0
In-game mods (GameBanana browser, search and installs, with the Mask Salesman), code-patch and cheat mods, the devs' test18 to test45 work (full performance overlay, frame pacing on, steady frame rate, save export and import, bug capture, new options rows, Setup's Mods page and Add to Steam), occlusion queries and new defaults, Auto resolution that scales, replay helper threads and robust buffers off by default, the options in sections.
This commit is contained in:
28
gpu/vk/shaders/renodx_glue/triforce_output.slangi
Normal file
28
gpu/vk/shaders/renodx_glue/triforce_output.slangi
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef TRIFORCE_RENODX_OUTPUT_SLANGI
|
||||
#define TRIFORCE_RENODX_OUTPUT_SLANGI
|
||||
// (Triforce) The gamma correction of NX2navi's HDR on RenoDX's Zelda OoT output encoder. scripts/renodx_shaders.py
|
||||
// compiles this file in front of RenoDX's encoder, the frame's last draw: it reads the finished picture (the scene and
|
||||
// the HUD over it, linear, white at 1) once and writes it as HDR10. The game's picture is made for a display of gamma
|
||||
// about 2.2, and the sRGB curve it is decoded with is linear near black, which leaves the darkest tones lighter than
|
||||
// such a display shows them. With the correction on, the encoder is given the picture as a display of gamma 2.2 or 2.4
|
||||
// shows its sRGB code (RenoDX's renodx::color::correct::GammaSafe); off, the picture as it is, and the encoder does what
|
||||
// it did without this file. The tone mappers are given a peak with the correction taken out of it, so that the brightest
|
||||
// light still lands on the display's peak (gpu/vk/vk_renodx.cpp peak_before_gamma).
|
||||
#include "triforce_settings.slangi"
|
||||
|
||||
float3 TriforceGammaCorrect(float3 color, float gamma_correction) {
|
||||
if (gamma_correction == 1.f) return renodx::color::correct::GammaSafe(color, false, 2.2f);
|
||||
if (gamma_correction == 2.f) return renodx::color::correct::GammaSafe(color, false, 2.4f);
|
||||
return color;
|
||||
}
|
||||
|
||||
/// The encoder's one read of the picture
|
||||
vec4 TriforceOutputPicture(sampler2D picture, vec2 at) {
|
||||
vec4 color = texture(picture, at);
|
||||
color.rgb = TriforceGammaCorrect(color.rgb, triforce_constants.settings.gamma_correction);
|
||||
return color;
|
||||
}
|
||||
// (from here on, which is RenoDX's encoder: its texture() is the read above)
|
||||
#define texture TriforceOutputPicture
|
||||
|
||||
#endif
|
||||
54
gpu/vk/shaders/renodx_glue/triforce_scene.slangi
Normal file
54
gpu/vk/shaders/renodx_glue/triforce_scene.slangi
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef TRIFORCE_RENODX_SCENE_SLANGI
|
||||
#define TRIFORCE_RENODX_SCENE_SLANGI
|
||||
// (Triforce) RenoDRT as a third tone mapper of RenoDX's Zelda OoT scene shaders, which have Vanilla and PsychoV35.
|
||||
// scripts/renodx_shaders.py compiles this file in front of each of RenoDX's two scene shaders. Those call
|
||||
// ApplySceneToneMap (RenoDX's scene_tonemap.slangi) for every tone mapper but Vanilla; here RenoDX's own keeps its body
|
||||
// under another name and the one the shaders call chooses: RenoDRT (tone_map_type 3, RenoDX's number for it) goes to
|
||||
// RenoDX's library, anything else to RenoDX's mapper as it is. So with Vanilla or PsychoV35 a scene shader does what it
|
||||
// did without this file.
|
||||
//
|
||||
// What RenoDRT does with the scene is what NX2navi's HDR does with it (runtime/shaders/hdr_tonemap.frag, tone mapper 3)
|
||||
// and RenoDX's own games do: the game's SDR picture of the scene is the colour grade, carried up to the display's range
|
||||
// by brightness against a neutral SDR curve of the same scene (renodx::draw::ToneMapPass), with RenoDRT's rows.
|
||||
#include "triforce_settings.slangi"
|
||||
|
||||
#define ApplySceneToneMap RenoDXApplySceneToneMap
|
||||
#include "scene_tonemap.slangi" // (RenoDX's)
|
||||
#undef ApplySceneToneMap
|
||||
|
||||
/// The game's own SDR picture of what it feeds its tone curve: that curve (Narkowicz's fit of ACES, with the numbers the
|
||||
/// game's shader has) and its clamp to 0..1
|
||||
float3 TriforceGameSdr(float3 x) {
|
||||
return saturate(x * (2.51f * x + 0.03f) / (x * (2.43f * x + 0.59f) + 0.14f));
|
||||
}
|
||||
|
||||
/// x: what the game feeds its tone curve (the scene with bloom, times the game's exposure). config: RenoDX's, with the
|
||||
/// peak, the whites and the four grading rows in it. Returns linear Rec. 709 with the menus' white at 1, as RenoDX's own
|
||||
/// scene mapper does
|
||||
float3 TriforceRenoDRT(float3 x, renodx::draw::Config config, TriforceSettings settings) {
|
||||
config.tone_map_type = renodx::draw::TONE_MAP_TYPE_RENO_DRT;
|
||||
// (the peak comes with the gamma correction taken out of it already: vk_renodx.cpp peak_before_gamma)
|
||||
config.gamma_correction = renodx::draw::GAMMA_CORRECTION_NONE;
|
||||
config.color_grade_strength = settings.color_grade_strength;
|
||||
config.tone_map_highlight_saturation = settings.highlight_saturation;
|
||||
config.tone_map_blowout = settings.blowout;
|
||||
config.tone_map_flare = settings.flare;
|
||||
config.tone_map_hue_correction = settings.hue_correction;
|
||||
float3 mapped = renodx::draw::ToneMapPass(x, TriforceGameSdr(x), config);
|
||||
mapped *= config.diffuse_white_nits / config.graphics_white_nits;
|
||||
// (as NX2navi's: a channel that is not a number is black)
|
||||
return float3(isnan(mapped.x) ? 0.f : mapped.x, isnan(mapped.y) ? 0.f : mapped.y, isnan(mapped.z) ? 0.f : mapped.z);
|
||||
}
|
||||
|
||||
float3 ApplySceneToneMap(float3 custom_untonemapped, float3 custom_native_gain) {
|
||||
if (RENODX_TONE_MAP_TYPE == renodx::draw::TONE_MAP_TYPE_RENO_DRT) {
|
||||
// (the game's exposure is the gain's first entry: both of the game's scene shaders multiply each channel by that one
|
||||
// number before their curve. RenoDX's shader with local exposure hands its own mapper a gain whose blue is that
|
||||
// number squared; RenoDRT starts from what the game's curve takes, so it takes the number itself for all three)
|
||||
return TriforceRenoDRT(custom_untonemapped * custom_native_gain.x, renodx::draw::BuildConfig(),
|
||||
triforce_constants.settings);
|
||||
}
|
||||
return RenoDXApplySceneToneMap(custom_untonemapped, custom_native_gain);
|
||||
}
|
||||
|
||||
#endif
|
||||
26
gpu/vk/shaders/renodx_glue/triforce_settings.slangi
Normal file
26
gpu/vk/shaders/renodx_glue/triforce_settings.slangi
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef TRIFORCE_RENODX_SETTINGS_SLANGI
|
||||
#define TRIFORCE_RENODX_SETTINGS_SLANGI
|
||||
// (Triforce) The settings RenoDX's Zelda OoT mod has no place for in its own block (shared.h ShaderInjectData, set 1
|
||||
// binding 4): the gamma correction and what RenoDRT alone reads. gpu/vk/vk_renodx.cpp fills them from the Insert menu's rows
|
||||
// (struct Extra, the same six floats in the same order) and gives them to every program with one of RenoDX's stages as
|
||||
// set 1 binding 5.
|
||||
//
|
||||
// This file and the two beside it are Triforce's own. They hold none of RenoDX's code: scripts/renodx_shaders.py compiles
|
||||
// them together with RenoDX's sources as it fetched them (github.com/clshortfuse/renodx, MIT, Carlos Lopez), and what they
|
||||
// call of RenoDX is its library as it is there.
|
||||
#include "shared.h" // (RenoDX's: its settings and, through renodx.hlsl, its library)
|
||||
|
||||
struct TriforceSettings {
|
||||
float gamma_correction; // 0 none, 1 a display of gamma 2.2, 2 of 2.4 (triforce_output.slangi)
|
||||
float highlight_saturation; // RenoDRT: 1 unchanged
|
||||
float blowout; // RenoDRT: 0 none
|
||||
float flare; // RenoDRT: 0 none
|
||||
float hue_correction; // RenoDRT: 1 the hue from before the tone mapper
|
||||
float color_grade_strength; // RenoDRT: 1 all of the game's own grading
|
||||
};
|
||||
|
||||
layout(set = 1, binding = 5, scalar) uniform TriforceShaderConstants {
|
||||
TriforceSettings settings;
|
||||
} triforce_constants;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user