[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Premultiplied alpha blending and issues with color accuracy




You usually do that with 2 textures and it works like this:
a = your current drawing
b = the current render target attached to an FBO

1. copy a to b by way of screen quad copy sourcing from a
2. draw what you want to add, sourcing from a and from whatever source
you need to draw, using your custom blending equation, still outputting to b
3. swap a and b

This would work in the case of an image calculated in the shader, I suppose, so that's a possible solution for the brush issue, but what about blending 2 textures together? I suppose that if I'm going to implement layers, I could just blend these to the main frame buffer by using premultiplied alpha, since I'm not actually outputting an alpha channel to the 3D canvas. For a low number of layers with relatively high opacity values, this should look fine, I guess.


Thor

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------