webvs icon indicating copy to clipboard operation
webvs copied to clipboard

Missing blendmodes

Open grandchild opened this issue 6 years ago • 0 comments

Some blendmodes are still unsupported:

  • [ ] XOR
  • [ ] Every other line
  • [ ] Every other pixel
  • [ ] Buffer

XOR

XOR is tricky in WebGL 1.0, which has no bitwise integer operations. There are involved algorithms which emulate xor.

  • https://stackoverflow.com/questions/373262/how-do-you-implement-xor-using
  • https://stackoverflow.com/questions/3543273/glsl-why-are-bitwise-operators-reserved-what-is-a-good-alternative-to-using-b#3543304

Every other *

Every other line/pixel is also not straightforward, because we need pixel-coordinate access. This code

mix(color, getSrcColor(), float(uint(dot(v_position, u_resolution-1.0)) & 1u))

(which is only valid in GLSL ES 3 / WebGl 2.0) produces different output across browsers -- and always incorrect (artifacts along the diagonal). If there's a way we could have not only 0-1-valued texture coordinates but also correct pixel/texel-coordinates, then we'd be done with these.

grandchild avatar Jun 25 '18 16:06 grandchild