From 9b99c76032bb96002fae6a5d67a41423a935119f Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Fri, 1 Jan 2021 16:01:33 +0000 Subject: [PATCH] Clamp alpha reference to avoid degenerate case --- files/shaders/alpha.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/shaders/alpha.glsl b/files/shaders/alpha.glsl index b1c7ed149..cb38831c5 100644 --- a/files/shaders/alpha.glsl +++ b/files/shaders/alpha.glsl @@ -15,7 +15,7 @@ uniform float alphaRef; void alphaTest() { #if @alphaToCoverage - float coverageAlpha = (gl_FragData[0].a - alphaRef) / max(fwidth(gl_FragData[0].a), 0.0001) + 0.5; + float coverageAlpha = (gl_FragData[0].a - clamp(alphaRef, 0.0001, 0.9999)) / max(fwidth(gl_FragData[0].a), 0.0001) + 0.5; // Some functions don't make sense with A2C or are a pain to think about and no meshes use them anyway // Use regular alpha testing in such cases until someone complains.