Skip to content

Commit 31ee10d

Browse files
author
David Gillen
committed
correct pre multiplied alpha error
1 parent 487cedd commit 31ee10d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/easeljs/filters/AberrationFilter.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@
8989
"vTextureCoord + (uColorDirection * uColorMultiplier.b)" +
9090
");" +
9191

92+
"float newAlpha = " + (alphaMax ?
93+
"max(rSample.a, max(gSample.a, max(bSample.a, sample.a)))" :
94+
"(rSample.a + gSample.a + bSample.a) / 3.0"
95+
) + ";" +
9296
"vec4 result = vec4(" +
93-
"rSample.r*rSample.a, " +
94-
"gSample.g*gSample.a, " +
95-
"bSample.b*bSample.a, " +
96-
(alphaMax ?
97-
"max(rSample.a, max(gSample.a, max(bSample.a, sample.a)))" :
98-
"(rSample.a + gSample.a + bSample.a) / 3.0"
99-
) +
97+
"min(1.0, rSample.r/(rSample.a+0.00001)) * newAlpha, " +
98+
"min(1.0, gSample.g/(gSample.a+0.00001)) * newAlpha, " +
99+
"min(1.0, bSample.b/(bSample.a+0.00001)) * newAlpha, " +
100+
"newAlpha" +
100101
");" +
101102
"gl_FragColor = mix(result, sample, uExtraProps[0]*sample.a);" +
102103
"}"

0 commit comments

Comments
 (0)