Transparency without background
Hi my problem:
I dont know what background will have result image of my transparent rendering.
glBlendFunc((GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) world fine with known background. But I cant render transparent image and send it, when I dont know bgcolor of viewer. For example if he has white background and I render image to white background, image will be blended twice and everything will be more white.
1. solution - get somehow bgcolor with request: render transparent image with transparent background (alpha = 0), and then set every pixel with alpha > 0 to alpha = 1
2. solution - somehow preserve color and set correct alpha channel, so it will look good with every bgcolor, but I dont have idea how.
2.1: When I have only one transparent triangle, its easy -> I need only to set correct alpha channel and write nonmultiplied color to color buffer. (i will not use blending at all). But when I have multiple triangles on top of each other I dont know what and how to blend and how to set result alpha value.
I really need and want to solve solution 2, how to do it in OpenGL ? IE. never blend with background, always only what I dra
Tags for this Thread