All examples By author By category About

redblobgames

blend-alpha

(redblobgames updated this block to use premultiplied alpha - http://apoorvaj.io/alpha-compositing-opengl-blending-and-premultiplied-alpha.html)

I can't figure out why points with gl_FragColor = vec4(255, 255, 255, .1); get darker and then lighter when overlaid with increasing density. (note: it should be vec4(1.0, 1.0, 1.0, 0.1) not 0-255 --redblobgames)

I'm using these blending settings:

blend: {
  enable: true,
  func: {
    srcRGB: 'src alpha',
    srcAlpha: 1,
    dstRGB: 'one minus src alpha',
    dstAlpha: 1
  },
  equation: {
    rgb: 'add',
    alpha: 'add'
  },
  color: [0, 0, 0, 0]
},

Tweaking them hasn't fixed the problem, but I'm not sure what I'm doing...