Parameters for this alpha blend

I was asking about this at the end of another thread and I think it is not read any more, so I will try in a thread which is about this subject and not something else.

I want to get a blended alpha value which works like this

if two surfaces are drawn on the same pixel and one has alpha=0.75 and the other has alpha=0.5 then i need the result to be 0.875.

If the two alphas were 1 and 0.5, i would need it to be 1.

I can see how this is done by 1 - (1-a1)*(1-a2)

What I can not see is how to set the alpha blend arguments to get this. There is no multiplication operation, and the operators which exist, doesnt seem to do what i want.

The point of my blend is to get a resulting alpha value which defines how much of the background will show through the graphics.

Can anyone provide some insight into how to do this

Edit:

I might add that the colors should be alpha blended as usual. This is for the seperate blending of the alpha values.



Answer this question

Parameters for this alpha blend

  • manojamin

    Use ONE and INVSRCALPHA for the blend factors. (Or INVDESTALPHA if a1 is your dest.)

    Should work in theory.

  • Skivan

    Ok. An operation of Add

    and then destination blend = DestinationAlpha

    og source blend = uhm..... invBlendFactor

    I cant quite figure out which one equals a2*(1-a1) if it is not invBlend...

    I will have to try it out, which I cant for now. Can you please confirm my guess


  • RogerLainson

    1 - (1-a1)*(1-a2) is not that hard. With a little math you get:

    1 - (1-a1)*(1-a2) = 1 - (1-a1) + (1-a1)*a2 = a1 + (1-a1)*a2

    a1*1 + a2*(1-a1) is in the form of a blending operation. I'm sure you can take it from here.

  • Parameters for this alpha blend