interferences-at / encreslumieres

Encres & lumières
0 stars 0 forks source link

Layers are surrounded by a grey halo when drawn over another layer #19

Open aalex opened 3 years ago

aalex commented 3 years ago

Strokes are surrounded by a grey halo when drawn on another stroke

How to reproduce

Technical details

It's a bug in Processing

Update: This bug is known upstream in Processing. The compositing of PGraphics assumes the input images to have non-premultiplied alpha. However, the output of any OpenGL blending is premultiplied. So when the offscreen gets drawn to the screen, the translucent colours around the blurred shape get multiplied by the alpha a second time, and you get a dark halo.

aalex commented 3 years ago

le bug du edge gris ca le fait juste apres un clear.

aalex commented 3 years ago

It looks pretty good, here:

image

aalex commented 3 years ago

Est-ce le bogue qui se produit encore @ElbyB ?

aalex commented 3 years ago

image

aalex commented 3 years ago

C'est peut être pas toutes les brush qui le font ? Essaie avec une autre brush

aalex commented 3 years ago

J'ai changé un truc dans la manière que l'on load les brosses: je transforme tous leurs pixels en blanc, et seule l'opacité change. Est-ce un bogue qu'il y avait déjà avant, ou est-il nouveau?

aalex commented 3 years ago

https://github.com/processing/processing/blob/9eb4e9b6c975d8e9d3cce85230300c04a52927c6/core/src/processing/opengl/PGraphicsOpenGL.java#L6258

It should be

pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA,
                            PGL.ONE,       PGL.ONE_MINUS_SRC_ALPHA);

instead of:

gl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA,
                            PGL.ONE,       PGL.ONE);
aalex commented 3 years ago

See my branch https://github.com/interferences-at/processing/tree/fix-3391-gray-halo

I've opened this PR: https://github.com/processing/processing/pull/6222