mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
rsx: Remove the alpha-to-coverage hack that was added to hide the missing mipmaps in games
- Moves to a purely stochastic function using dithering to simlulate coverage
This commit is contained in:
parent
f0ed0285f3
commit
0c35595ce2
1 changed files with 4 additions and 12 deletions
|
@ -555,22 +555,14 @@ namespace glsl
|
||||||
|
|
||||||
if (props.emulate_coverage_tests)
|
if (props.emulate_coverage_tests)
|
||||||
{
|
{
|
||||||
// NOTES:
|
// Purely stochastic
|
||||||
// Lowers alpha accuracy down to 2 bits, to mimic A2C banding
|
|
||||||
// Alpha lower than the real threshold (e.g 0.25 for 4 samples) gets a randomized chance to make it to the lowest transparency state
|
|
||||||
// Helps to avoid A2C tested foliage disappearing in the distance
|
|
||||||
// TODO: Fix dithering when mipmap gather is finished to remove muddy appearance. Alpha boost is only present to hide far LOD issues in titles like RDR
|
|
||||||
OS <<
|
OS <<
|
||||||
"bool coverage_test_passes(/*inout*/const in vec4 _sample, const in uint control)\n"
|
"bool coverage_test_passes(const in vec4 _sample, const in uint control)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if ((control & 0x1) == 0) return false;\n"
|
" if ((control & 0x1) == 0) return false;\n"
|
||||||
"\n"
|
"\n"
|
||||||
" float samples = float(control & 0x6) * 0.5f + 1.f;\n"
|
" float random = _rand(gl_FragCoord);\n"
|
||||||
" float hash = _saturate(_rand(gl_FragCoord) + 0.5f) * 0.9f;\n"
|
" return (_sample.a > random);\n"
|
||||||
" float epsilon = hash / samples;\n"
|
|
||||||
" float alpha = trunc((_sample.a + epsilon) * samples) / samples;\n"
|
|
||||||
" //_sample.a = min(_sample.a, alpha);\n" // Cannot blend A2C samples naively as they are order independent! Causes background bleeding
|
|
||||||
" return (alpha > 0.f);\n"
|
|
||||||
"}\n\n";
|
"}\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue