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:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user