vk: rt: tune emissive/additive blending so that it matches original
To match original more closely it additive geometry should be added to final color in sRGB-γ space. You might not like that it is physically incorrect, but this is what peak compatibility looks like. Related to #668
This commit is contained in:
parent
59f7d264c2
commit
caac371681
|
@ -1079,3 +1079,11 @@ xash vk (remapped)
|
|||
+Y = -X
|
||||
+X = +Z
|
||||
+Z = +Y
|
||||
|
||||
# 2023-12-22 E352
|
||||
## sRGB vs γ blending
|
||||
Original:
|
||||
`color = a + b`
|
||||
Our:
|
||||
`color = sqrt(a*a + b*b)`
|
||||
There's nothing we can to do `a` only that would make it fake the "original" mixing result.
|
||||
|
|
|
@ -306,8 +306,18 @@ void main() {
|
|||
colour = diffuse + specular;
|
||||
}
|
||||
|
||||
// See issue https://github.com/w23/xash3d-fwgs/issues/668, map test_blendmode_additive_alpha.
|
||||
// This macro enabled adding emissive to the final color in the *incorrect* sRGB-γ space. But it makes
|
||||
// it look much more like the original. Adding emissive in the *correct* linear space differs
|
||||
// from the original a lot, and looks perceptively worse.
|
||||
#define ADD_EMISSIVE_IN_GAMMA_SPACE
|
||||
#ifndef ADD_EMISSIVE_IN_GAMMA_SPACE
|
||||
// Physically correct, but looks dull
|
||||
colour += imageLoad(emissive, pix).rgb;
|
||||
colour = LINEARtoSRGB(colour);
|
||||
#else // INCORRECT
|
||||
colour = LINEARtoSRGB(colour) + LINEARtoSRGB(imageLoad(emissive, pix).rgb);
|
||||
#endif
|
||||
|
||||
imageStore(out_dest, pix, vec4(colour, 0./*unused*/));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue