From 9fdfd609dc5f250ddcbc1aef87619ea0b0e0806c Mon Sep 17 00:00:00 2001 From: Dave Pagurek Date: Sat, 18 Jan 2025 11:27:46 -0500 Subject: [PATCH] Add 0 check before dividing color by alpha --- src/webgl/shaders/phong.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webgl/shaders/phong.frag b/src/webgl/shaders/phong.frag index 74c5206d95..d4d2205b80 100644 --- a/src/webgl/shaders/phong.frag +++ b/src/webgl/shaders/phong.frag @@ -49,7 +49,7 @@ void main(void) { inputs.color = isTexture ? TEXTURE(uSampler, vTexCoord) * uTint/255. : vColor; - if (isTexture) { + if (isTexture && inputs.color.a > 0.0) { // Textures come in with premultiplied alpha. Temporarily unpremultiply it // so hooks users don't have to think about premultiplied alpha. inputs.color.rgb /= inputs.color.a;