17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-05 06:24:27 +01:00

Add a white balance to the tonemapping

This commit is contained in:
2026-10-27 01:40:19 +01:00
parent 82d3842495
commit ac0b4e5f15
13 changed files with 122 additions and 6 deletions

View File

@@ -21,13 +21,15 @@ layout(set = POST_SET, binding = POST_TEXTURE_FIRST + 1) uniform sampler2D bloom
// param[0].x: share of the bloom in the image (0: no bloom, the texture is not read), param[0].y: 1 if the automatic
// exposure is applied (exposure_ssbo of common.glsl, worked out by exposure_average.comp), param[0].z: fixed exposure multiplier, param[0].w: scale of
// the bloom texture (it holds the sum of the levels of the chain), param[1].x: 1 when this is the last pass before the
// window, which takes the dither
// window, which takes the dither, param[1].yzw: gains of the white balance (0: none)
void main()
{
vec2 texcoord = f_coords;
vec3 hdr_color = texture(tex1, texcoord).xyz;
if (param[0].x > 0.0)
hdr_color = mix(hdr_color, texture(bloom_tex, texcoord).rgb * param[0].w, param[0].x);
if (param[1].y > 0.0)
hdr_color = white_balance(hdr_color, param[1].yzw);
float exposurescale = param[0].z;
if (param[0].y > 0.5 && exposure > 0.0)
exposurescale *= exposure;