PDA

View Full Version : Blending color

nachovall
04-30-2009, 03:46 AM
Hi all.

I'm using blending functions to composite k transpancy layers. For my purposes I need to know if it's possible that combining n diferents colors with the same transparency factor, the result is the same blended color.

Anybody knows this?

Thanks.

ZbuffeR
04-30-2009, 11:18 AM
k ? n ? same blender color ? What do you want exactly ?

nachovall
05-01-2009, 01:17 AM
It's difficult to explain...

I'm rendering high order Voronoi diagrams via GPU. Doing a deepth peeling I have stored in "k" textures the layers of each peel. Now I need to blend all textures in order to obtain the final composition of the high order Voronoi diagram.

Once this done, I have to do some operations over the composite Voronoi diagram (readpixels...). My algorithm only works iff there's no cell of the composite diagram with the same color that belongs to different pairs of cells.

That's because of my question. For instance:

If I blend

red+blue+red+gren+yellow+orange+blue --> Color(143,121,233)

Is it possible that if I Blend:
"Diferents colors than before" --> Color(143,121,233)

If the combination of the different layers are different, that means that belong to a different final cell. So they should have different colors.

My quetion is because I don't know if it could happen that an strange combination of colors and blending the result is the same color.

I now the example is stupid but I think is clear.

I use glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA).

Thanks.

ZbuffeR
05-01-2009, 10:02 AM
So you want to compute something like a non-colliding hash of a number of colors. If the number of different colors is not too big, it should be doable, but the hash must have enough storage bits to encode all the different values (maybe n*k in your case ?).
By the way you have to do this custom blend through a fragment shader, as the old fixed function pipeline would be too restrictive.

nachovall
05-04-2009, 02:15 AM