Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alpha Compositing and shyts
#3
((r1*a1 + r2*(255-a1)*(a2/(double)255))/a0 + .5)

((r1*a1/(double)255/a0 + r2*(255-a1)*(a2/(double)255))/a0 + .5)

Hope that makes sense, you need to scale back r1, g1, b1 with respect to their overall alpha (a0), or you're multiplying by 11 twice.


At least that's how I understand the formula to work. I might be off by a factor of 255 because I'm not exactly sure how that works.


Anyway, conceptually if a1 + a2 ~= a0, then you have a1/a0 + a2/a0 ~= 1 -> multiply 1 by original colours, weighted by their relative alpha.
Reply


Messages In This Thread
Alpha Compositing and shyts - by KajitiSouls - 2009-12-11, 12:15 AM
Alpha Compositing and shyts - by Nikkey - 2009-12-11, 05:08 AM
Alpha Compositing and shyts - by Stereo - 2009-12-11, 10:07 AM
Alpha Compositing and shyts - by KajitiSouls - 2009-12-11, 04:08 PM
Alpha Compositing and shyts - by Nikkey - 2009-12-11, 05:20 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)