I want to fill a SKShapeNode
with a linear gradient. Being a programming perfectionist I want the solution to be as customizable as possible. So I decided to use a
If you change c1
and c2
to other colors, the bug will stay there.
CodePudding user response:
Like the comments said, the color value you return should already be premultiplied by the fragment's alpha value.
From Apple's documentation - Creating a Custom Fragment Shader:
Typically, the color value you return in this variable should already be premultiplied by the fragment’s alpha value.
You might also want to use v_color_mix.a
if you want your shader to take into account the alpha value set on the node:
gl_FragColor = col * v_color_mix.a;