mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-25 18:48:51 -04:00
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
48 lines
3.4 KiB
Plaintext
48 lines
3.4 KiB
Plaintext
#version 450
|
|
// Frame generation (vk_framegen.cpp hud_source): AMD FSR 3.1's interpolation source, the game's frame with its HUD marked
|
|
// in the alpha. The game draws its HUD into the same picture as the scene, after its gameplay upscale; the renderer keeps
|
|
// a copy of that picture from just after the upscale (framegen_hud_before), so whatever differs from it in the picture as
|
|
// presented (the hearts, the minimap, the button prompts, their see-through parts and soft edges) is the HUD: alpha 0
|
|
// there, 1 elsewhere. The patched interpolation (scripts/fsr3_shaders.py FI_PATCHES) keeps those pixels where they are.
|
|
// And the same crop of the picture before the HUD: FSR 3.1's own HUD-less colour (vk_fsr3fi.h Inputs::present), which it
|
|
// interpolates instead, so no HUD of either frame is moved with the scene, and on which it lays this frame's HUD after.
|
|
// (tests/test_fsr3fi_hudless_colour.py compiles hudless_colour as C++, and makes fg_hud_comp_spv.h: --write)
|
|
layout(local_size_x = 8, local_size_y = 8) in;
|
|
layout(binding = 0) uniform sampler2D frame; // the game's frame as fg_copy cropped it (RGBA8)
|
|
layout(binding = 1) uniform sampler2D before; // the picture as the upscale left it, before the HUD
|
|
layout(binding = 2) uniform sampler2D after; // the picture as presented, the HUD on it
|
|
layout(binding = 3, rgba8) uniform writeonly image2D dst;
|
|
layout(binding = 4, rgba8) uniform writeonly image2D hudless; // the picture before the HUD, cropped as dst
|
|
// (the crop's corner in the picture, and its size; pq: 1 the picture is the native HDR one, already encoded)
|
|
layout(push_constant) uniform P { ivec2 offset; ivec2 size; int pq; } pc;
|
|
|
|
// The sRGB encode of a linear value, clamped as the RGBA8 frame is
|
|
float srgb1(float v) {
|
|
v = clamp(v, 0.0, 1.0);
|
|
return v <= 0.0031308 ? 12.92 * v : 1.055 * pow(v, 1.0 / 2.4) - 0.055;
|
|
}
|
|
vec3 srgb(vec3 v) { return vec3(srgb1(v.r), srgb1(v.g), srgb1(v.b)); }
|
|
|
|
// A pixel's HUD-less colour: scene, the picture before the HUD; drawn, the same picture as presented; shown, the frame's
|
|
// pixel. It has to be the presented frame's to the bit wherever nothing was drawn over the picture: FSR 3.1 lays the
|
|
// presented frame over its made one wherever the two differ at all (ffx_frameinterpolation_inpainting.h, HUD-less mode).
|
|
// The picture is in linear light (B10G11R11) and the frame is presented sRGB-encoded (RGBA8): the copy taken as it was
|
|
// differed everywhere, and every made frame came out as the game's frame itself (FSR 3.1 at 4x showed each game frame four
|
|
// times: RTX 3090, 42 fps, Upscaler Off, the made frames the same as the game's to the bit). Under the HUD the copy,
|
|
// encoded as the frame is (sRGB; pq: the native HDR picture, encoded already): left linear, it was far darker than the
|
|
// frame, a dark ring around the HUD's see-through parts and the effects drawn after the upscale (the fairy's glow)
|
|
vec3 hudless_colour(vec3 scene, vec3 drawn, vec3 shown, bool pq) {
|
|
if (scene == drawn) return shown;
|
|
return pq ? clamp(scene, 0.0, 1.0) : srgb(scene);
|
|
}
|
|
|
|
void main() {
|
|
const ivec2 g = ivec2(gl_GlobalInvocationID.xy);
|
|
if (any(greaterThanEqual(g, pc.size))) return;
|
|
const ivec2 q = g + pc.offset;
|
|
const vec3 scene = texelFetch(before, q, 0).rgb, drawn = texelFetch(after, q, 0).rgb;
|
|
const vec3 shown = texelFetch(frame, g, 0).rgb;
|
|
imageStore(dst, g, vec4(shown, scene != drawn ? 0.0 : 1.0));
|
|
imageStore(hudless, g, vec4(hudless_colour(scene, drawn, shown, pc.pq != 0), 1.0));
|
|
}
|