Skip to content

Incorrect implementation of alpha in shader #9

@pineapplemachine

Description

@pineapplemachine

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions