I’m using an FBO to render out several individual images to do anti-aliasing.
- clear scene out with (0,0,0,0)
- draw geometry without color writes (zpass)
- with depth test set to LEQUAL and blending set to GL_ONE/GL_ONE render geometry
I’m left with however many sampled images and am currently combining them by hand (just to check). Using a box filter, I multiply every channel in every image by 1/n and add them together. This gives basically correct results on the object itself, but when I composite over something else, I notice there’s a slight black edge around my objects, where I’m not taking premultiplication into account.
If I understand correctly, colors along the border with an RGBA of (.5,.5,.5,.5) should look more like (1,1,1,.5) so it with won’t be so dark when its composited. What’s the actual premultiplication that needs to be done?
It seems like this normally wouldn’t be an issue if the scene is completely full of rendered geometry, but this isn’t the case every render.
I’ve attached two images–one over a transparent background and the other over an opaque white background, where the problem shows up.