Skip to content
Snippets Groups Projects
Commit ff683a71 authored by Dave Houlton's avatar Dave Houlton
Browse files

SL-12865, add bias to alpha mask values to avoid 8-bit acne

parent eb45c054
No related branches found
No related tags found
No related merge requests found
......@@ -230,7 +230,10 @@ void main()
vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK)
if (diffuse_linear.a < minimum_alpha)
// Comparing floats cast from 8-bit values, produces acne right at the 8-bit transition points
float bias = 0.001953125; // 1/512, or half an 8-bit quantization
if (diffuse_linear.a < minimum_alpha-bias)
{
discard;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment