pixi-sdf-text icon indicating copy to clipboard operation
pixi-sdf-text copied to clipboard

Incorrect implementation of alpha in shader

Open pineapplemachine opened this issue 7 years ago • 0 comments

I was looking through the code in this repo and noticed https://github.com/PixelsCommander/pixi-sdf-text/blob/master/src/sdf.frag#L23

gl_FragColor = vec4(color, alpha) * u_alpha;

This causes the RGB channels to also be multiplied by the alpha value, darkening the color as it becomes less opaque.

What was almost certainly the intended behavior would be better represented as:

gl_FragColor = vec4(color, alpha * u_alpha);

pineapplemachine avatar Jan 22 '19 08:01 pineapplemachine