Fix: Workbench: Color imprecision for pure black color

The bias for mapping to log color space was wrong and
was assuming `log(2x)` instead of `log2(x)`.

This made pure black colors result in 0.00008 values
after AA resolve.

Using the correct bias ensures 0 stays at 0 during the
AA process and doesn't exhibit any imprecision.
This commit is contained in:
Clément Foucault
2025-07-01 11:04:46 +02:00
parent 293cdac6ab
commit 1c41815c4d
2 changed files with 2 additions and 2 deletions

View File

@@ -428,7 +428,7 @@ void dof_gather_init(float base_radius,
/* TODO(fclem) Seems like the default lod selection is too big. Bias to avoid blocky moving out
* of focus shapes. */
constexpr float lod_bias = -2.0f;
lod = max(floor(log2(base_radius * unit_sample_radius) + 0.5f) + lod_bias, 0.0f);
lod = max(floor(log2(base_radius * unit_sample_radius) + 1.0f) + lod_bias, 0.0f);
if (no_gather_mipmaps) {
lod = 0.0f;

View File

@@ -34,7 +34,7 @@ void main()
}
out_color /= taa_accumulated_weight;
/* Exit log2 space used for Anti-aliasing. */
out_color = exp2(out_color) - 0.5f;
out_color = exp2(out_color) - 1.0f;
/* Avoid float precision issue. */
if (out_color.a > 0.999f) {