mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Add colour profiles and brightness, contrast, saturation and gamma for the picture
Issue #136. With TOTK_COLOR_* away from their defaults, present_image runs one compute pass (vk_color.c, shaders/color_grade.comp) that writes the game picture's crop, adjusted, into an RGBA16F image, and FSR 1 or the blit scale that one; at the defaults nothing runs. The Screen tab gets a Colour group: a profile (Game's own, Vivid, Clarity, Custom) that sets the four values, and the four sliders. The adjustment, its order, ranges and presets are STS78721's patch from the issue, reworked onto dev: it now applies with FSR 1 scaling as well as the blit, its menu texts come from the catalog in English and Russian, and the patch's unused accessors and build_game.py change are left out. Co-authored-by: STS78721 <134802927+STS78721@users.noreply.github.com>
This commit is contained in:
1 parent
7d62cbfa85
commit
c0567191f0
10 files changed
+382
-7
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#version 450
|
||||
// Colour adjustment on the present (runtime/vk_color.c): the game's picture, crop rectangle at offset, into an RGBA16F
|
||||
// image the FSR 1 pass or the blit then scales to the window. Brightness, contrast around mid-grey, saturation against
|
||||
// Rec. 709 luma, then a power curve: the order and ranges of STS78721's colour profiles (issue #136).
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
layout(binding = 0) uniform sampler2D src;
|
||||
layout(binding = 1, rgba16f) uniform writeonly image2D dst;
|
||||
layout(push_constant) uniform P {
|
||||
ivec2 offset; // the crop rectangle's corner in src
|
||||
ivec2 size; // its size, the size of dst
|
||||
vec4 adj; // brightness (added), contrast, saturation, gamma (exponent)
|
||||
} pc;
|
||||
|
||||
void main() {
|
||||
ivec2 p = ivec2(gl_GlobalInvocationID.xy);
|
||||
if (any(greaterThanEqual(p, pc.size))) return;
|
||||
vec3 c = texelFetch(src, p + pc.offset, 0).rgb;
|
||||
c += pc.adj.x;
|
||||
c = (c - 0.5) * pc.adj.y + 0.5;
|
||||
c = mix(vec3(dot(c, vec3(0.2126, 0.7152, 0.0722))), c, pc.adj.z);
|
||||
c = pow(max(c, vec3(0.0)), vec3(pc.adj.w));
|
||||
imageStore(dst, p, vec4(clamp(c, 0.0, 1.0), 1.0));
|
||||
}
|
||||
Reference in new issue
Block a user